From owner-freebsd-bugs Mon Dec 28 21:30:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA19206 for freebsd-bugs-outgoing; Mon, 28 Dec 1998 21:30:12 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA19199 for ; Mon, 28 Dec 1998 21:30:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id VAA07924; Mon, 28 Dec 1998 21:30:01 -0800 (PST) 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 X-Send-Pr-Version: www-1.0 Subject: misc/9230: Problem with iostreams, seekg, tellg Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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