public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/5799: streams reading from fifo
@ 2002-04-05 11:54 bkoz
  0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2002-04-05 11:54 UTC (permalink / raw)
  To: benko, bkoz, gcc-bugs, gcc-prs, nobody

Synopsis: streams reading from fifo

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Fri Apr  5 11:54:38 2002
Responsible-Changed-Why:
    Mine. Craig asked me to take a look at this last month, sorry for the delay.
State-Changed-From-To: closed->analyzed
State-Changed-By: bkoz
State-Changed-When: Fri Apr  5 11:54:38 2002
State-Changed-Why:
    Like libstdc++/6047.....

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5799


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/5799: streams reading from fifo
@ 2002-03-03 23:16 Pal Benko
  0 siblings, 0 replies; 4+ messages in thread
From: Pal Benko @ 2002-03-03 23:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/5799; it has been noted by GNATS.

From: Pal Benko <benko@sztaki.hu>
To: rodrigc@gcc.gnu.org, benko@sztaki.hu, gcc-bugs@gcc.gnu.org,
 gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org
Subject: Re: libstdc++/5799: streams reading from fifo
Date: Mon, 04 Mar 2002 08:09:04 +0100

 No.  My problem is not that spaces are removed from the output, but
 that I get the output only when the buffer is overrun on the input
 side of the pipe.  Even if the input side explicitly flushes the
 stream attached to the pipe, the output side does not get the data.
 This is so with your version as well.
 
 Regards,
 
 Pal Benko
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/5799: streams reading from fifo
@ 2002-03-02 19:37 rodrigc
  0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2002-03-02 19:37 UTC (permalink / raw)
  To: benko, gcc-bugs, gcc-prs, nobody

Synopsis: streams reading from fifo

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Sat Mar  2 19:37:55 2002
State-Changed-Why:
    Not a bug in gcc.  For questions about C++, read a good
    C++ book or ask C++ usage questions on the comp.lang.c++.moderated
    Usenet newsgroup.
    
    You probably want to write something like:
    #include <fstream>
    #include <iostream>
     
    int
    main ()
    {
      std::ifstream in ("/tmp/pipe");
      char c;
     
     
      while (in.get(c)) std::cout.put(c);
      return 0;
    }
    
    See 21.3.4 Input of Characters, in Stroustrup's
    book for an example.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5799


^ permalink raw reply	[flat|nested] 4+ messages in thread

* libstdc++/5799: streams reading from fifo
@ 2002-03-01  2:56 benko
  0 siblings, 0 replies; 4+ messages in thread
From: benko @ 2002-03-01  2:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5799
>Category:       libstdc++
>Synopsis:       streams reading from fifo
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 01 02:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Benko Pal
>Release:        3.0.4
>Organization:
>Environment:
SuSE linux 7.3 i686 libc 2.2.4
>Description:
Perhaps this is not a bug.

if an ifstream reads from a named pipe, it sees the data
only when the buffer is full or the pipe is closed, but not
when the process writing to the pipe flushes.  Using
<stdio.h> there is no such problem.

e.g. compiling and running

#include <fstream>
#include <iostream>


int
main()
{
  std::ifstream in("/tmp/pipe");
  char          c;

  while (in >> c)
    std::cout << c;
  
  return 0;
}

while in an other shell I

$ mkfifo /tmp/pipe
$ cat > /tmp/pipe
hello
world
^D
$

In the shell running the c++ program
helloworld
only appears after ^D.


But compiling and running

#include <stdio.h>


int
main()
{
  FILE *in = fopen("/tmp/pipe", "r");
  char c;

  while ((c = fgetc(in)) != EOF)
    putchar(c);

  return 0;
}

After entering hello and pushing enter, hello appears
on the output of the program.

Is a special initialisation of the ifstream needed perhaps?
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-05 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-05 11:54 libstdc++/5799: streams reading from fifo bkoz
  -- strict thread matches above, loose matches on Subject: below --
2002-03-03 23:16 Pal Benko
2002-03-02 19:37 rodrigc
2002-03-01  2:56 benko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).