#1151 empty write access at pos 1 vs. N greater than 1

None
invalid
nobody
None
none
1
2014-01-11
2013-01-01
frank
No

After writing an empty string in a new file at position 1 the file exists with size 0.
After writing one character into a new file at position N the file exists with size N.
After writing an empty string in a new file at position N the file exists witj size 0.

I'd expect a minimal size N-1 after any successful write access at position N, also for an empty charout( FILE, '' ), at the moment only position 1 works as expected yielding size 0.

1 Attachments

Discussion

  • Erich

    Erich - 2013-06-05

    I'd expect a minimal size N-1 after any successful write access

    According to 7.4.15. CHAROUT, "the string can be a null string, in which case no characters are written to the stream, and 0 is always returned."

    As nothing is written to the file, your result should be the expected behavior

     
  • Rick McGuire

    Rick McGuire - 2013-11-20
    • status: open --> invalid
     
  • Rick McGuire

    Rick McGuire - 2013-11-20

    There is no such thing as writing an empty string. If there is no data to write, then nothing is written. the 0-length file is not created by the act of writing the null string, but by opening the file itself.

     
  • frank

    frank - 2014-01-11

    This issue had a "high astonishment factor" for me in experiments with "sparse" FAT disk images created in a REXX script. Writing lots of NUL bytes is slow; just changing the position beyond the current EOF is fast. Apparently the trick is to seek to POS-1 and write one NUL instead of going to POS and write zero bytes.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks