Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Code C]:Write in to file

12 views
Skip to first unread message

Bertram

unread,
Apr 21, 2013, 9:27:39 AM4/21/13
to


Hi all


It possible write in specific position, in to file.txt previously written,
without losing the content?

Thanks

Regards



Barry Schwarz

unread,
Apr 21, 2013, 12:17:39 PM4/21/13
to
On Sun, 21 Apr 2013 15:27:39 +0200, "Bertram" <nos...@nospam.org>
wrote:

>It possible write in specific position, in to file.txt previously written,
>without losing the content?

Only if you are appending to the end of the file. If you write data
anywhere before the end, the new data will replace the old.

--
Remove del for email

Francis Glassborow

unread,
Apr 21, 2013, 12:56:33 PM4/21/13
to
Or if you are over-writing the contents. Generally edits involve
insertions and/or deletions and that requires a new file.

Francis

Bill Gill

unread,
Apr 21, 2013, 1:05:05 PM4/21/13
to
The most common procedure is to write the data from the file
to a new file one piece at a time and insert the new data at
the correct place. When you have the whole file, with the
insertions, you delete the old file and rename the new file
to match the old one.

Bill

Geoff

unread,
Apr 21, 2013, 1:49:29 PM4/21/13
to
On Sun, 21 Apr 2013 15:27:39 +0200, "Bertram" <nos...@nospam.org>
wrote:

>
>
To insert new data into a file you must open a new file, copy the data
from the beginning of the original file into the new file up to the
point where you want to insert new data, write your new data, pick up
copying the remaining data from the original file to the end of the
file, close the new and old files, delete the old file and rename the
new file to replace the old file.

Bertram

unread,
Apr 21, 2013, 2:40:02 PM4/21/13
to

Ok.

Many thanks!

Regards


0 new messages