Yes, I agree but is it possible using a single file manipulation. The other way 
I understand is that I create a temp file and write modified data there or read 
st.st_size (file size) and re-write the whole modified data. But then assume I 
have 5 million of data there for processing and memory allocation fails ... 
(the only help is see is call brk()) or split the file to a limited size and do 
processing.
 
Regards,
Prakash



----- Original Message ----
From: Thomas Hruska <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, February 1, 2008 6:32:27 AM
Subject: Re: [c-prog] Inser record in text file

Satya Prasad wrote:
> I am trying (C program in unix) to insert data into a text file while reading 
> the file in "r+" mode. The issue is that it overwrites the text file content 
> if data to be inserted is more than the length of data read. 
> 
> Is there is a possible way to insert data in a text file without overwriting 
> data in the file?
> 
> Regards,
> Prakash

There is no such thing as a "record" in C/C++. A "text" file is just a 
special case of a binary file. Although, I argue that there is no such 
thing as a text file either. I treat all files as a stream of bytes or 
a chunk of raw data, which solves the problem.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task. Stay on task.

http://www.CubicleS oft.com/MyTaskFo cus/





      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

[Non-text portions of this message have been removed]

Reply via email to