Re: Writing a character to the beginning of the same file
- From: "jake" <jacob.basham@xxxxxxxxx>
- Date: 27 Apr 2005 21:16:10 -0700
>>So what is the solution to write a character to the >>beginning of
the
>>file and not affect the existing content.
When you want to add to an existing file, you need to build the
handlers to "move" the existing data in the location where to want to
write the new data, if you want to keep the data which was there.
However, there is a work around you could work with. You could set up a
random access file leaving x amount of bytes open before you start
writing your data. This would leave an empty space before your data
where you would be able to write a character or any data type which
does not run into the pre-existing data.
So, for example, if you wanted to 'insert' a single character into a
files, you would first need to know, would this only happen once, and
if it did happen more then once, would you be replacing the first
character you added.
If it is only going to happen once, or if you would replace the
character. After you create a new file, set the pointer to x amount of
bytes needed for the character, then write your data. When you want to
add the single character, you simply add it to the empty space you left
at the beginning.
.
- References:
- Writing a character to the beginning of the same file
- From: SAM
- Re: Writing a character to the beginning of the same file
- From: Scott McPhillips [MVP]
- Re: Writing a character to the beginning of the same file
- From: SAM
- Writing a character to the beginning of the same file
- Prev by Date: Re: Writing a character to the beginning of the same file
- Next by Date: xAml ?
- Previous by thread: Re: Writing a character to the beginning of the same file
- Next by thread: Re: Writing a character to the beginning of the same file
- Index(es):
Relevant Pages
|