Clive Page wrote:
>>Actually, I still don't quite see why the restriction is needed: what
>>harm can come from being able to re-write a section of a file starting
>>at any arbitrary byte-offset, since one can do this with an unformatted
>>file? I suppose it must be something to do with the penchant that some
>>systems have for inserting arbitrary CR and/or LF characters in
>>formatted output, which would make the resulting character-count hard to
>>determine.
Another reason for the restriction is that some languages use variable
numbers of bytes to represent a character. A typical Japanese text file
for example would contain ASCII characters in their usual one byte form
and Japanese characters in two bytes form, both kinds intermixed. There
are even more complicated files that contain state-shift bytes (which are
really not part of any character) that change character encodings in the
middle of a file. So byte-offset is not equivalent to character-offset,
even before newline handling.
If punch cards had a lot more holes to choose from for each character,
a byte would have been large enough for any character today and the
problem would have been avoided, I think. ;-)
--
Yasuki Arasaki
[log in to unmask]
|