By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

File read/write operations

P: n/a
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. :)
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

Smoothy wrote:
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. :)


Nov 13 '05 #2

P: n/a
Thanks for your reply, Pushkar.

--

"Pushkar Pradhan" <pu*****@gri.msstate.edu> wrote in message
news:3F**************@gri.msstate.edu...
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.

Smoothy wrote:
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. :)

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.