473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

File read/write operations

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
2 7104
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I...
7
by: Shane | last post by:
Hi, Thanks in advance for the help. I have been to many websites and tried several solutions to my problem, but have fixed part of it. It's time to come humbly to the newsgroups for help :-) ...
11
by: Jeevan | last post by:
Hi, I have some data which I am getting from a socket. I am currently storing the data in an array (so that future reading of the data will be fast as it will be in RAM instead of hard disk)....
8
by: siliconwafer | last post by:
Hi All, If I open a binary file in text mode and use text functions to read it then will I be reading numbers as characters or actual values? What if I open a text file and read it using binary...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
7
by: Anbu | last post by:
Hi, I want to load contents of a remote HTML file and to display it on the ASP ..NET Web Page. The remote HTML file is not under any virtual folder and the content & location may vary for each...
4
by: Vai2000 | last post by:
Hi All, I have a Server which is in the DMZ, I need to do some File I/O on this box from my internal servers. How should I proceed with it? My internal servers are Win2k and DMZ is Win2k3..and yes...
9
by: Julien Biezemans | last post by:
Hi! Here is the problem: I'd like to restrict local filesystem stream operations to one directory just like a root jail. fopen('/file.bin') would actually open /some/path/file.bin. One goal...
3
by: japi | last post by:
Hi, i would like to know what approach i should use to insert (not append) a line of text to the begin of an existing text file. My current approach works, but i am afraid of loosing data if...
8
by: dosworldguy | last post by:
I have been having a very peculiar issue from a long time. I have an application where multiple clients read from a shared set of files. When a record is changed, sometimes the win9x clients...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.