How do you truncate a file?

Lance Bledsoe lwb at pensoft.uucp
Tue May 7 05:46:14 AEST 1991


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???



-- 
Lance Bledsoe                       Off:    (512) 343-1111                 
Pencom Software, Inc.               Fax     (512) 343-9650                 
8716 Loop 360 N. Suite 300          UUCP:   cs.utexas.edu!pensoft!lwb      
Austin, Texas  78759                UUNET:  uunet!uudell!pensoft!lwb       



More information about the Comp.lang.c mailing list