Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 1998 21:25:19 -0800 (PST)
From:      pknerr@ntsource.com
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   misc/9230: Problem with iostreams, seekg, tellg
Message-ID:  <199812290525.VAA18675@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         9230
>Category:       misc
>Synopsis:       Problem with iostreams, seekg, tellg
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 28 21:30:01 PST 1998
>Last-Modified:
>Originator:     Philip Knerr
>Organization:
Cognition Media Group
>Release:        3.0
>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.
>Audit-Trail:
>Unformatted:

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



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