delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/20/00:11:16

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10108200407.AA18104@clio.rice.edu>
Subject: Re: Fseek on STDIN problem on Win 2K
To: acottrel AT ihug DOT com DOT au (Andrew Cottrell)
Date: Sun, 19 Aug 2001 23:07:28 -0500 (CDT)
Cc: djgpp-workers AT delorie DOT com
In-Reply-To: <001301c128b2$21beb2c0$0a02a8c0@acceleron> from "Andrew Cottrell" at Aug 19, 2001 11:23:21 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I am just about to go to bed and thought I should send this now and work on
> it tomorrow night. It appears that when I open STDIN as a file and set the
> file position to zero it really goes to the third character in the input
> stream. The input stream is a file that I pipe in usign the "<". I have
> included a sample program below that shows the problem. If the test file is
> "1234567890ABCDEF" then the test program reads the "34567" characters on Win
> 2K, but on Win 98 with the same EXE it reads the "12345" characters.

Interesting observations:
1) I build this, and I see the same problem on W2K and XP
2) Same binary, if I set lfn=n then it works fine.
3) Same source, but built with V2.03 library works.

So, it appears related to LFN stuff, and it appears it was broken after V2.03.

If I remove the fseek(pfp, 0, Seek_set) there is no change in the strange
behavior.

If I remove the fstat at the beginning of this code (and hardwire pfp) the
problem goes away.  I'm guessing we are reading the magic number in fstat
and the pointer isn't getting set correctly?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019