delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/03/08/17:11:39

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <007701be69b0$82e83850$6400a8c0@orion.olvi.org>
From: "Michael V. Nikolaev" <mvn AT gu DOT kiev DOT ua>
To: <earnie_boyd AT yahoo DOT com>, "cygwin users" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: [bug] Crazy I/O. -cont.
Date: Tue, 9 Mar 1999 00:09:30 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id RAA14263

I took a look at implementation of FILE structure in newlib/libc/include/sys/reent.h (src distribution). It contains the field -offset:

struct __sFILE {
    ...
    int    _offset;    /* current lseek offset */
    ...
};

Struct FILE typedef'ed as __sFILE. So, there exist two file offset references: one for streams, another for block I/O. I think, block I/O is based on WinAPI file I/O. Stream I/O should be built, in general, on block I/O level. And when you use lseek() the resulting file offset is not sinchronized with the file offset field in the respective stream structure (*stdin, in your case) because block I/O knows nothing about stream I/O.

Regards,

Micahel

-----Original Message-----
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
To: Michael V. Nikolaev <mvn AT gu DOT kiev DOT ua>; cygwin users <cygwin AT sourceware DOT cygnus DOT com>
Date: 8 березня 1999 р. 21:45
Subject: Re: [bug] Crazy I/O.


>---"Michael V. Nikolaev" <mvn AT gu DOT kiev DOT ua> wrote:
>>
>> 
>> -----Original Message-----
>> From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
>> To: cygwin users <cygwin AT sourceware DOT cygnus DOT com>
>> Date: 8 березня 1999 р. 18:46
>> Subject: [bug] Crazy I/O.
>> 
>> 
>> Hi!
>> 
>> You use stdin as a _stream_ when calling gets(). So, try to call
>fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
>> 
>
>Didn't help.  Besides, it shouldn't be needed.
>==
>-                        \\||//
>-------------------o0O0--Earnie--0O0o-------------------
>--                earnie_boyd AT yahoo DOT com               --
>-- http://www.freeyellow.com/members5/gw32/index.html --
>----------------------ooo0O--O0ooo----------------------
>
>PS: Newbie's, you should visit my page.
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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