Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!pacbell.com!pacbell!rtech!mtxinu!sybase!sirdan!djd From: djd@sirdan.sybase.com (dan debrunner) Newsgroups: comp.lang.c Subject: Re: How do you truncate a file? Summary: not this way Message-ID: <12653@sybase.sybase.com> Date: 9 May 91 22:23:18 GMT References: <1991May5.024348.4203@csusac.csus.edu> <1991May6.194614.9641@pensoft.uucp> Sender: news@Sybase.COM Distribution: usa Organization: Sybase, Inc. Lines: 18 In article <1991May6.194614.9641@pensoft.uucp> lwb@pensoft.uucp (Lance Bledsoe) writes: >In article fitz@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 >>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??? Actually a correct way would have been even better. Remember putchar() is a macro on many platforms which evaluates its argument twice. Dan.