Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!ucdavis!csusac!usenet From: cilibrar@athena.ecs.csus.edu (Rudi Cilibrasi) Newsgroups: comp.sys.amiga.programmer Subject: How do you truncate a file? Keywords: truncate, file Message-ID: <1991May5.063352.6627@csusac.csus.edu> Date: 5 May 91 06:33:52 GMT Sender: usenet@csusac.csus.edu (News account (alt)) Distribution: usa Organization: California State University, Sacramento Lines: 7 Suppose that I have a 100-byte file, and I want to get rid of the last ten bytes. Is there any way to do this other than freading in the entire file and then fwriting out only 90 bytes of it? I'd like to find a way to avoid having to read the whole file into memory. I've heard that there is a function called ftruncate that does this, but my compiler (Aztec C 5.0) doesn't have this one. (It also doesn't have chsize, which was another suggestion) Thanks for any help.