How do you empty a file using C programming?

1 answer

Answer

1036270

2026-04-14 10:30

+ Follow

That depends on the type of file and what you mean by "empty". Generally, fopen() called on an existing file, with the "w" option instead of the "a" option will truncate the file to zero length. To delete a file completely is a different process. Function truncate is your friend.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.