hi ppl..assignment due in 2 days...this is the file that i need to read...
Code:
*CLASS* YES NO
alt yes no
bar yes no
fri yes no
*DATA*
YES,yes,no,no,yes,some,high,no,yes,french,0-10
NO,yes,no,no,yes,full,low,no,no,thai,30-60
YES,no,yes,no,no,some,low,no,no,burger,0-10
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...
i have the code working ok...only problem is right now in my code i do this:
Code:
while (in.peek() != '\n') //where 'in' is the ifstream operator
{
//read each word from the line by using in >> smth;
}
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...
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...
Farooq
P.S.
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?