Can anyone recommend the best way to validate text input from an ascii file?
Each line of my input file is expected to be:
Some Text \t Some Text \t Some Text\n
However, if the program encounters a line with only whitespace, an exception is raised.
Here is a code snippet (without any validation):
while (fgets(line, 209, inF) != 0) {
text1 = strtok (line, "\t"
text2 = strtok (NULL, "\t"
text3 = strtok (NULL, "\t"
}
It seems like a job for Regexes - but I don't know how to do that in C++.
Thanks in advance for any help.
Each line of my input file is expected to be:
Some Text \t Some Text \t Some Text\n
However, if the program encounters a line with only whitespace, an exception is raised.
Here is a code snippet (without any validation):
while (fgets(line, 209, inF) != 0) {
text1 = strtok (line, "\t"
text2 = strtok (NULL, "\t"
text3 = strtok (NULL, "\t"
}
It seems like a job for Regexes - but I don't know how to do that in C++.
Thanks in advance for any help.