i can use seekg and seekp functions to jump around differnt locations in the file with offset.
But now the txt file is written like:
200200125,41123,John
200200125,31054,,David
200200125,45305,Nick
200200125,44866,Smith
200200125,41024,Cathy
200200127,31525,Steve
200200127,42429,Robert
200200127,42430.,Serena
...
i wanna serch a lines with its second numer 44923 and get its first number.
the way i used:
char ID,secNum,name;
while(strcmp(secNum,"44923")!=0&&!inFile.eof()){
inFile.getline(ID,size,',');
inFile.getline(secNum,size,',');
inFile.getline(name,size,'\n');}............
it turns out work anyway. however,i dont like it becuase there would be too many assignments in the loop if there are more sections in every line. i just wanna skip the other sections in each line. apparently i can not use "seekg" function because the lenths of names are different. so how can i do that in a smart way?