Does anyone know, how I can shrink a file in C.
Without copying into a buffer an recopying or something like that. Only open the file, make a cut on a position.
Is there a way in C?
It's not a C topic: it's OS function. For example, MS Windows can't truncate files in so manner, but IBM MVS can do it.
Accordingly no such function(s) in C Standard library.
Portable code must do this op vith rewriting a new file then renaming.
Luckily for us, it's the most safe method too...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.