Append text midfile?

BlitzMax Forums/BlitzMax Beginners Area/Append text midfile?

SculptureOfSoul(Posted 2006) [#1]
Is there any way to append text to a file anywhere besides at the end of the file?

What I'm trying to do split a file into sections (each section acts as an index file to another file ) and then simply extend a particular section when needed.

I.e.

Section 1: 0-2000 bytes
Section 2: 2001-3900 bytes
Section 3: 3901-12000 bytes


I'd like to be able to say jump to the end of section 2, at byte 3901, and append some data.

If there's no easy way to do this (I can't seem to find one, and can't think of a logical approach that would be easy and efficient) I'll just make each separate section it's own file.


tonyg(Posted 2006) [#2]
Read the first 'x' bytes into a stream, add your text, read the remaining bytes or to eof(infile). Write the stream back out.


SculptureOfSoul(Posted 2006) [#3]
Hmm, seems simple enough! :)

Thanks.

Now I've just got to see how big these files end up getting and if it wouldn't be smarter to break them up into separate files (anyways) for the performance boost.