I have a file similar to the one below
@
@
1 2 3
4 5 6
7 8 9
I want to ignore lines starting with an '@' character. My current code to parse the file is straightforward.
string line;
while(getline(in, line)) {
if(line[0] == '@')
continue
// do something with line
}
The amount of @ tokens in the file will be small and will always occur at the beginning of the file, but I don't want to have to go through the if check after every read. I would rather read the header section in a separate function, then start reading the desired data without the need for the if check. How can I do this?