Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2011 16:47:58 -0500
From:      Brian Reichert <reichert@numachi.com>
To:        "Julian H. Stacey" <jhs@berklix.com>
Cc:        hackers@freebsd.org
Subject:   Re: reverse of  getchar() read() open() fopen() ?
Message-ID:  <20110211214758.GI36025@numachi.com>
In-Reply-To: <201102112132.p1BLWkiP003000@fire.js.berklix.net>
References:  <201102112132.p1BLWkiP003000@fire.js.berklix.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 11, 2011 at 10:32:46PM +0100, Julian H. Stacey wrote:
> Hi hackers@, 
> Do we have C libraries with reverse of getchar() [ & maybe read()
> ] & fopen() [ & maybe open() ] etc, to read from end of file toward
> beginning ?  I dont see anything in the See Also sections.  I'm not
> looking to write, just read.  I'm looking for something that returns
> last char in file as first etc, I'm not interested in wchars etc,
> I could write some C functions, with seek etc & probably will, if
> none exist, but no point if they already exist ?

Use lseek() to position yourself, iterate over the file, copying into a
small buffer, then iterate over your buffer in reverse?

Maybe I misunderstood you...

> Cheers,
> Julian

-- 
Brian Reichert				<reichert@numachi.com>
55 Crystal Ave. #286			
Derry NH 03038-1725 USA			BSD admin/developer at large	



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110211214758.GI36025>