Printing a file backwards

Dave Horsfall dave at pyramids.OZ
Wed Oct 16 12:05:02 AEST 1985


> with the lines in the reverse order.  It 'fgetc()'s its way through
> the file to count the number of characters, then backs up, spiting
> 
> scott dawkins
> {hplabs|ucbvax}!hpda!sdawkins
> 
> 	/* find out how many characters are in the file */
> 	for (count = 0; (c = fgetc(in_file)) != EOF; ++count)
> 		;
> 	--count;
> 
What's wrong with "stat" ?  Or isn't that "portable"?
(Yes - I know, KRE - we don't export net.sources back to the yanks.
This is a sincere request for information no matter who can answer it.)
--
Dave Horsfall VK2KFU	 ISD: +61 2 438-1266   VTL: 248181000
Lionel Singer Group	 STD:  (02) 438-1266
20 Waltham St		ARPA: munnari!pyramids.oz!dave at SEISMO
Artarmon  NSW  2064	UUCP: seismo!munnari!pyramids.oz!dave
AUSTRALIA		 ACS: dave at pyramids, dave at elecvax, dave at runx
	"V7 was the last Unix"



More information about the Comp.sources.unix mailing list