Microsoft KB Archive/64901

PRB: DosWrite Won’t Write Data If Entire Bufffer Won’t Fit PSS ID Number: Q64901 Article last modified on 09-20-1991 PSS database name: O_Os2SDK

1.21

OS/2

Summary:

SYMPTOMS While using the DosWrite call, if there is not room on a floppy or hard disk to write the entire buffer, nothing is written. The return code is zero (no error), and the bytes written value is also zero. The expected behavior is for DosWrite to write whatever it could at that time.

CAUSE By design, the above behavior by DosWrite is considered correct, and is consistent with such commands as the OS/2 COPY command.

RESOLUTION If the DosWrite call only writes zero bytes, determine the amount of free space on the floppy or hard disk and write that amount to the floppy or hard disk (adjusted for the remaining space in the last cluster of the file).

The overhead for this method is minimal because it is only necessary to check whenever the floppy or hard disk fills up, and not after every write.

Copyright Microsoft Corporation 1991.