prev up next   top/contents search

comp.lang.c FAQ list · Question 19.13

Q: How can a file be shortened in-place without completely clearing or rewriting it?

A: BSD systems provide ftruncate, several others supply chsize, and a few may provide a (possibly undocumented) fcntl option F_FREESP. Under MS-DOS, you can sometimes use write(fd, "", 0). However, there is no portable solution, nor a way to delete blocks at the beginning or in the middle. See also question 19.14.

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North