fputc

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

guys, when you use "fputc" does it write the data to storage or to the internal buffer?  I ask because updating the storage and file size seems excessive for one byte?

This topic has a solution.
Last Edited: Thu. May 5, 2022 - 10:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Doesn't the f stand for file? And of course the "file"can be anything from what I remember.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It would normally be buffered, depending on the exact type and disposition of the file.

Buffered data (for typical disk-like files) will actually be written when the buffer fills, or when you close the file, or perhaps in the case of some other operations (fflush(), maybe fseek(), etc.)

This is why you should make sure your program doesn't crash before you've closed the files!