Yet "OUT" is exactly the same as the type_string compare (using strcmp(type_string,"OUT") produces the same result. Additionally, when I view the "type_string" char array in VS, it simple says it contains "OUT". What could be causing this and is there a reliable way of comparing strings?
// build a prototype codon sequence from a file array as input
std::vector<Codon> BuildCodonSequence(charconst filename[])
{
unsignedstaticconst large_int = 1000000; // maximum characters in a line of strings before this will break
std::vector<Codon> codon_vector; // the codon vector that will be returned
std::ifstream file;
file.open(filename); // open file
while(file.good())
{
switch (file.peek())
{
case'#' :
// found a comment tag; ignore the rest of the line
file.ignore(large_int,'\n');
break;
case',' :
// found a delimiter; ignore it
file.ignore(1,EOF);
break;
case'\n' :
// found end of line, ignore it
file.ignore(1,'\n');
break;
case'\t' :
// found a tab, ignore it
file.ignore(1,'\t');
break;
default:
// found something else, presumably a codon function string
// create a string container and fill it with the codon type string
char codon_type_string[3];
file.get(codon_type_string,4);
// add the type to the codon vector
codon_vector.push_back(Type(codon_type_string));
break;
}
}
return codon_vector;
}
Where Type() is the function which is given type_string as in the original post.