Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Nov 1999 14:41:15 -0600
From:      Chris Costello <chris@calldei.com>
To:        Zhihui Zhang <zzhang@cs.binghamton.edu>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: A file with holes - a bug?
Message-ID:  <19991122144115.L78478@holly.calldei.com>
In-Reply-To: <Pine.GSO.3.96.991122133521.4039A-100000@sol.cs.binghamton.edu>
References:  <Pine.GSO.3.96.991122133521.4039A-100000@sol.cs.binghamton.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 22, 1999, Zhihui Zhang wrote:
> 	lseek(fileno(fp),  3 * 8192, SEEK_CUR);

> If I remove the fflush(fp), then the characters 0x30-0x39 will be all
> written at the end of the file (use hexdump to find out), not as expected
> (one at the beginning and the other at the end).  It seems to me that the
> first for loop happens AFTER the lseek() statement without fflush().  Can
> anyone explain this to me?  I am using FreeBSD 3.3-Release.

   That line (as quoted) where you use lseek is broken.  Use
fseek instead.

   Use only one method to access files.  Either stdio or the
open/read/write syscalls.

-- 
|Chris Costello <chris@calldei.com>
|If a group of N persons implements a COBOL compiler, there will be N-1
|passes.  Someone in the group has to be the manager.    -- T. Cheatham
`----------------------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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