From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 11 22:14:40 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE5CA106566B for ; Fri, 11 Feb 2011 22:14:40 +0000 (UTC) (envelope-from reichert@numachi.com) Received: from meisai.numachi.com (meisai.numachi.com [198.175.254.6]) by mx1.freebsd.org (Postfix) with SMTP id 27BAC8FC13 for ; Fri, 11 Feb 2011 22:14:39 +0000 (UTC) Received: (qmail 7484 invoked by uid 1001); 11 Feb 2011 21:47:58 -0000 Date: Fri, 11 Feb 2011 16:47:58 -0500 From: Brian Reichert To: "Julian H. Stacey" Message-ID: <20110211214758.GI36025@numachi.com> References: <201102112132.p1BLWkiP003000@fire.js.berklix.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201102112132.p1BLWkiP003000@fire.js.berklix.net> User-Agent: Mutt/1.5.9i Cc: hackers@freebsd.org Subject: Re: reverse of getchar() read() open() fopen() ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2011 22:14:41 -0000 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 55 Crystal Ave. #286 Derry NH 03038-1725 USA BSD admin/developer at large