..but without reading and writing the whole file in question?
Ok. Let me explain, if I can.
Hello everyone. Its been a long time since I last singed on. Good to be
back. Well, I have a question and I need your help.
I'm trying to write to a file. Any file, since it doesn't matter at this
point in time. But, because some of the times will be very large, I do
not want to read/write in the triditional way, example:
BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
BlockWrite(ToF, Buf, NumRead, NumWritten);
until (NumRead = 0) or (NumWritten <> NumRead);
What I want to do is just 'write' directly to the file itself. You see,
the size is 1 byte (a number value or something else) and it only needs
to be written in one place, but the place (position) will ber user
configurable, because the position will vary from file to file. But they
only need to write one piece of data to the file. I'm using a TrackBar
control and an EditBox for the file position edits.
Sort of like this. Say you have a file who is only 8 bytes in size, and
the data in it is obviously 8 pieces of data. Can be anything, but lets
just simplify the example with a string of values who are charactors, like
And I have determined that I need to change the third position data from
'C' to a 'D', like this, it should now become:
Now the third position is a 'D', and not a 'C'.
But this could be any data value.
I'm not familiar with file structures. But, if its a matter of defining
a structure of some sort that ALL files contain, I'm hopping that it will
be an easy step to set up a standard file structure (as long as I know
what the file containes. Could be an AVI file or a MPEG file or an TXT
file in most cases. So, I know that MPEG's have a certain file structure,
and AVI's do, but the TXT files I'm not sure of. Or, maybe it doesn't
matter, as long as I have the filename and size, I could write my one-byte
to (transpose) any data element that is at the user requested position.
Also, I'll assume that the file structures is the same for windows 98
and windows 2k and XP. I'm using XP and windows 98, if that matters.
And, I'm sure that others will be using XP mostly.
Lets see. There is FAT16, FAT32, NTFC
Please, I could really use the help on this. And it would save a lot
of time and file space if all I had to do was transpose 1 byte in a file,
like the above example.
Thanks really much.