From: utzoo!decvax!harpo!seismo!hao!menlo70!sytek!zehntel!zinfandel!berry Newsgroups: net.lang.c Title: Re: Re: read/write same file with one op - (nf) Article-I.D.: zehntel.722 Posted: Tue Feb 1 01:19:51 1983 Received: Fri Feb 4 06:19:18 1983 #R:rabbit:-107800:zinfandel:14600002:000:630 zinfandel!berry Jan 31 12:23:00 1983 /* What's wrong with this? It does stuff to the contents of a file and leaves the new stuff in the old file. */ #includemain() { FILE *in, *out; int c; /* diddle with a file... */ in = fopen ( "input_file", "r"); out = fcreat ("tmp_dooda", "w"); while ( (c = fgetc ( in )) != EOF ) fputc ( filter(c), out); fclose (in); fclose (out); unlink ( "input_file"); link ( "tmp_dooda", "input_file"); unlink ("tmp_dooda"); } filter(c) int c; { /* do whatever it is you're doing here*/ return mung(c); } /* Berry Kercheval * Zehntel Inc. * (decvax!sytek!zehntel!zinfandel!berry) * (415)932-6900 */