Lingyun Yang wrote:
Hi every one,
I need some help on inserting some strings into a big file.
I know if it's appending, I can use append mode when open the
file, but how about the insert ? Read out to a buffer, insert
to the buffer and then write back? since it's a 10-20M file.
and the inserting is once every 10-20 sec.
In this method, the program would be very slow
There is no standard way short of re-writing the whole file. Your OS
and/or file system might not even support inserting -- I don't think
there are many that do (but I could be wrong).
You can always check your systems documentation for a way of doing what
you want, or reconsider your algorithm (perhaps changes could be cached
in memory, and written to the file only occasionally, for example).
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.