File read/write operations

S

Smoothy

Hi all,

Can someone help me with the following issue?
I want to read/write from/to a particular position (line/character) of a
text file.
How can I do this?
In other words, how can I tell to the position indicator in a file to go to
a specific
(line/character) position in the file?
[The length of lines in the file are NOT known]
It seems that the "fseek" command is of no use in text mode.

Thanks in advance for your help. :)
 
P

Pushkar Pradhan

I don't think there is any magic function which will let you do that. If
you know the "keyword" then you have to parse the file to look for it's
first occurrence.
If you know that you want to read only the 10th line then you can write
fscanf to skip the first 9 lines.
 
S

Smoothy

Thanks for your reply, Pushkar.

--



Pushkar Pradhan said:
I don't think there is any magic function which will let you do that. If
you know the "keyword" then you have to parse the file to look for it's
first occurrence.
If you know that you want to read only the 10th line then you can write
fscanf to skip the first 9 lines.
Hi all,

Can someone help me with the following issue?
I want to read/write from/to a particular position (line/character) of a
text file.
How can I do this?
In other words, how can I tell to the position indicator in a file to go to
a specific
(line/character) position in the file?
[The length of lines in the file are NOT known]
It seems that the "fseek" command is of no use in text mode.

Thanks in advance for your help. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top