Search code examples
cwindowsvisual-studiofwrite

C Programming fwrite on full drive


What happens to fwrite if it the drive is full? Assuming that it was compiled on a windows machine with visual studio.

Thanks!


Solution

  • If a write cannot be performed, fwrite() either returns a short item count (if some items have been written before an error occurred) or 0. fwrite() does not block if an error occurs. To differentiate and end-of-file condition from an IO error, use the feof() and ferror() functions.