How do you truncate a file?

Donn Pedro dfpedro at uswnvg.UUCP
Wed May 8 00:23:44 AEST 1991


In article <1991May6.194614.9641 at pensoft.uucp>, lwb at pensoft.uucp (Lance Bledsoe) writes:
: In article <f25g_zd at rpi.edu> fitz at mml0.meche.rpi.edu (Brian Fitzgerald) writes:
: >Rudi Cilibrasi writes:
: >>Suppose I have a 100-byte file called "myfile.dat", and I want to get
: >>rid of the last 10 bytes.
: >
: >#include <stdio.h>
: >main () {
: >int	i;
: >for (i=0; i < 90 ; i++) {
: >		(void) putchar(getchar());
: 
: Do you think you could have thought of a *slower* way to do this???

Could you then post the *faster* way?



	dfpedro at uswnvg.UUCP



More information about the Comp.lang.c mailing list