Prev: save inside a specific folder
Next: Array problem
From: Himanshu Bahirat on 20 Feb 2010 19:29 Hello, I am using fgetl function to read line by line from a file. When I reach a particular line, I wish to skip reading next two lines from the file. For this I need to know the index of current line being read and then increment it. So the questions is:- 1.How to know the index of line being read? 2.How to increment the index and then send to updated index to fgetl? I just need to do this a few time and then I want the fgetl not to have any other change. I appreciate any suggestions and inputs. regards,
From: Walter Roberson on 20 Feb 2010 21:15 Himanshu Bahirat wrote: > Hello, > I am using fgetl function to read line by line from a file. > When I reach a particular line, I wish to skip reading next two lines > from the file. > For this I need to know the index of current line being read and then > increment it. There is no way to find that information except to keep increment a counter each time you read a new line. (Well, there is an alternative, but it requires reading the file through once before you start and keeping track of the offset of every newline in the file.) > So the questions is:- > 1.How to know the index of line being read? No way to find out except to count the lines yourself. > 2.How to increment the index and then send to updated index to fgetl? No way to do that. If you want to skip two lines, then just make two fgetl() calls and don't do anything with what you read in. > I just need to do this a few time and then I want the fgetl not to have > any other change.
|
Pages: 1 Prev: save inside a specific folder Next: Array problem |