How do you truncate a file?

Jeremy J Starcher r3jjs at VAX1.CC.UAKRON.EDU
Wed May 8 12:41:58 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???
>

#include <stdio.h>
main () 
{
 int i;

  for (i = 0; i < 90; i++)
  {
    (void) putchar(getchar());
    sleep(60);            /* Make it even slower */
  }
}


-- 
--------------------------+---------------------------------------------------
Jeremy J Starcher         !  No programmer programs in LOGO after reaching
r3jjs at vax1.cc.uakron.edu  !  age 14...
r3jjs at akronvm.bitnet      !



More information about the Comp.lang.c mailing list