Using ifstream problems...[URGENT]
hi ppl..assignment due in 2 days...this is the file that i need to read...
so basically store the classes in the first line then in the next lines before *DATA* read in each item separately and then after *DATA* read in everything separately...
*CLASS* YES NO
alt yes no
bar yes no
fri yes no
i have the code working ok...only problem is right now in my code i do this:
this is not very effective because let's say in the file if before a newline character at the end of a line i have a space and then a newline, then my code runs into problems...
while (in.peek() != '\n') //where 'in' is the ifstream operator
//read each word from the line by using in >> smth;
is there a way to say that do this until the end of the line...like eof is there something like eol (end of line) so i can use while !eol???
thanks a lot...
another question is regarding repositioning of the pointer...i want to store the pointer position at the line startting alt and then go until the line starting fri and count the number of lines (i.e. no. of lines between the first line and the line starting *DATA*)
after counting i want to start at alt again so i can start reading in the data...how to do this?