I could tool up to test this, but it oughta be simpler just to
ask here!
What happens when you grossly over-reach a Variable Length file
in PB 3.5 for DOS?
I typically do a quick file integrity check 'proof' on many of the
Variable Length files created. My habit is to not use the record
number one for actual data, but to use it for check-sum sort of
results from data that has to be normally known from the cap record.
That way, if the initial record doesn't conform to both the needed
check data that was generated by the cap record, and that doesn't
match what else the system knows about this file, we can begin to
suspect the file is corrupt. So far for years, that's worked well
enough to catch most thingees that go bump in the night.
Now I want to very much enlarge the entire record size in a certain
file. Obviously, to 'discover' that the file might be the old length
record style, much shorter, I can't quite rely, I think, on any
normal EOF technique to tell me. In this case, the EOF and last
byte record for the file will be at, say the 277,000 byte mark, where
the new file size would put that same place at about 4,777,000 bytes.
I don't really want to open it twice, once in straight Binary to see
what the EOF byte mark is, then compare it to what was in the first
record, which I could do. Turns out that the two versions will, for
fact, have the first 512 bytes that match exactly in the file.
Thus even if I open it in the much larger length for the new format,
whatever data was at the Magic Point(s) in the first record will
still track and tell me what the expected cap and crypt code check
sum was for the original file .. even if that is WAY short in the
new one!
Now comes the curious point!
I could do a 'read' for data in at the supposed known good record
NUMBER location in the file. But of course that will put it FAR
beyond the 'end' of what is the old file that is the wrong style
which might be still on some disk or restoration effort!
If I do that, as far as I know, I think (?) <- puppu with tail in
curly cue if it does't smiley funny, the box will cheerfully go out
and 'read' Heaven knows what from where?
What does PB 3.5 do when this happens? Will it attempt to actually
read beyond the actual EOF on that hard disk? Or will it return
a disk I/O error that I can actually trap to make the determination?
That said, if it does return garbage, and I discover it, if I then
close the file, what happens to the file itself for having tried
to read way past the end?
Curious puppy wants to know!
Thank you ..
------------------
Mike Luther
[email protected]
ask here!
What happens when you grossly over-reach a Variable Length file
in PB 3.5 for DOS?
I typically do a quick file integrity check 'proof' on many of the
Variable Length files created. My habit is to not use the record
number one for actual data, but to use it for check-sum sort of
results from data that has to be normally known from the cap record.
That way, if the initial record doesn't conform to both the needed
check data that was generated by the cap record, and that doesn't
match what else the system knows about this file, we can begin to
suspect the file is corrupt. So far for years, that's worked well
enough to catch most thingees that go bump in the night.
Now I want to very much enlarge the entire record size in a certain
file. Obviously, to 'discover' that the file might be the old length
record style, much shorter, I can't quite rely, I think, on any
normal EOF technique to tell me. In this case, the EOF and last
byte record for the file will be at, say the 277,000 byte mark, where
the new file size would put that same place at about 4,777,000 bytes.
I don't really want to open it twice, once in straight Binary to see
what the EOF byte mark is, then compare it to what was in the first
record, which I could do. Turns out that the two versions will, for
fact, have the first 512 bytes that match exactly in the file.
Thus even if I open it in the much larger length for the new format,
whatever data was at the Magic Point(s) in the first record will
still track and tell me what the expected cap and crypt code check
sum was for the original file .. even if that is WAY short in the
new one!
Now comes the curious point!
I could do a 'read' for data in at the supposed known good record
NUMBER location in the file. But of course that will put it FAR
beyond the 'end' of what is the old file that is the wrong style
which might be still on some disk or restoration effort!
If I do that, as far as I know, I think (?) <- puppu with tail in
curly cue if it does't smiley funny, the box will cheerfully go out
and 'read' Heaven knows what from where?
What does PB 3.5 do when this happens? Will it attempt to actually
read beyond the actual EOF on that hard disk? Or will it return
a disk I/O error that I can actually trap to make the determination?
That said, if it does return garbage, and I discover it, if I then
close the file, what happens to the file itself for having tried
to read way past the end?
Curious puppy wants to know!
Thank you ..
------------------
Mike Luther
[email protected]
Comment