File Buffering Can Hide Out-of-Disk-Space ConditionLast reviewed: July 17, 1997Article ID: Q57889 |
5.10 6.00 6.00a 6.00ax 7.00 8.00 8.00c | 1.00 1.50 1.51 1.52
MS-DOS | WINDOWSkbprg The information in this article applies to:
SUMMARYIn Microsoft C, if disk space is exceeded, file buffering fails when buffering is done by the stream I/O functions. For example, if a file buffer for a stream is set to 10K by setvbuf() but only 2K of disk space is available, all data above 2K written to the buffer will be lost. This problem can occur even when setvbuf() and fwrite() return successful return codes.
MORE INFORMATIONWhen there is less space on the disk than there is in the stream buffer, all stream I/O functions will seem to work properly until the stream buffer is filled [for example, fwrite() returns the number of bytes written as if it were successful]. However, the status of these functions is valid only for the data going to the buffer and is not reflected in the file that is written to the disk. The problem is due to the existence of both the C run-time buffers and the MS-DOS buffers. Only when the MS-DOS buffers try to write to disk does it become evident that the disk is full. Then, the next return value from fwrite() will indicate failure. The following is the series of events that leads to the loss of data with buffered stream I/O functions:
|
Additional reference words: kbinf 6.00 6.00a 6.00ax 7.00 1.00 1.50 1.51
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |