From nobody  Mon Dec 28 21:25:19 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id VAA18675;
          Mon, 28 Dec 1998 21:25:19 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199812290525.VAA18675@hub.freebsd.org>
Date: Mon, 28 Dec 1998 21:25:19 -0800 (PST)
From: pknerr@ntsource.com
To: freebsd-gnats-submit@freebsd.org
Subject: Problem with iostreams, seekg, tellg
X-Send-Pr-Version: www-1.0

>Number:         9230
>Category:       misc
>Synopsis:       Problem with iostreams, seekg, tellg
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 28 21:30:01 PST 1998
>Closed-Date:    Tue Mar 23 09:35:23 PST 1999
>Last-Modified:  Tue Mar 23 09:40:00 PST 1999
>Originator:     Philip Knerr
>Release:        3.0
>Organization:
Cognition Media Group
>Environment:
FreeBSD addr.com. 3.0-RELEASE FreeBSD 3.0-RELEASE #5: Thu Dec 10 00:19:42 PST 1998     root@addr.com.:/usr/src/sys/compile/SMP-GENERIC  i386

>Description:
I have found a likely bug in FreeBSD 3.0.  It involves the iostreams
capability in C++.  In a nutshell, seekg'ing backwards from the
end of a file leaves the file marked as in an end-of-file state.
iostream::seekg(0, ios::beg) causes iostream::tellg to correctly
return zero, but the next read nevertheless returns EOF.  This
code works on SCO Unix, which is what leads me to believe this is
an OS issue.  The test code was specifically modified to more clearly
bring out the problem and details on what is actually happening.

Regards,
Philip Knerr
Cognition Media Group
pknerr@ntsource.com

>How-To-Repeat:
I have test code and a data file; feel free to E-mail me for them
at pknerr@ntsource.com.
>Fix:
I would think having iostream::seekg check to see if, after the seek,
the file is still at EOF and setting or clearing the EOF status
bit accordingly would solve the problem cleanly and easily.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Mar 23 09:35:23 PST 1999 
State-Changed-Why:  
Can't make contact with author to acquire How-To-Repeat. 

From: Sheldon Hearn <sheldonh@iafrica.com>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: misc/9230: Problem with iostreams, seekg, tellg
Date: Tue, 23 Mar 1999 19:36:57 +0200

 Unable to contact originator, not author. :-)
 
>Unformatted:
