public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help with stdiostream.h
@ 2004-02-19 19:22 Kevin Stedman
  2004-02-19 23:13 ` Claudio Bley
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Stedman @ 2004-02-19 19:22 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 537 bytes --]

I just upgraded to RedHat v. 9.  It delivers gcc 3.2.2
with it.  When I am compiling code I get the message
"stdiostream.h:  no such file or directory".  Where
did this library go.  Is there a replacement for it
 
I founf a copy in the g++-3 directory, but htis causes
even more errors.  I am trying to use the stdiobuf
class from this.  Is there a replacement for this?
 
 
Kevin Stedman



__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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

* Re: Help with stdiostream.h
  2004-02-19 19:22 Help with stdiostream.h Kevin Stedman
@ 2004-02-19 23:13 ` Claudio Bley
  2004-02-20 14:37   ` Kevin Stedman
  0 siblings, 1 reply; 4+ messages in thread
From: Claudio Bley @ 2004-02-19 23:13 UTC (permalink / raw)
  To: gcc-help

On Thu, Feb 19, 2004 at 11:22:50AM -0800, Kevin Stedman wrote:
> I just upgraded to RedHat v. 9.? It delivers gcc 3.2.2
> with it.? When I am compiling code I get the message
> "stdiostream.h:? no such file or directory".? Where
> did this library go.? Is there a replacement for it
> ?
> I founf a copy in the g++-3 directory, but htis causes
> even more errors.? I am trying to use the stdiobuf
> class from this.? Is there a replacement for this?

Have a look at ext/stdio_filebuf.h

HTH
-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux user                         - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \

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

* Re: Help with stdiostream.h
  2004-02-19 23:13 ` Claudio Bley
@ 2004-02-20 14:37   ` Kevin Stedman
  2004-02-20 21:58     ` Claudio Bley
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Stedman @ 2004-02-20 14:37 UTC (permalink / raw)
  To: gcc-help

Is there an example someplace on how this is used.  I
am getting errors trying to compile the code below on
the line that uses the stdio_filebuf.

when i compile I get these error msgs:

'lp_buf' undeclared

parse error before 'lp_pipe'


My code:

#include <iostream.h>
#include <ext/stdio_filebuf.h>
#include <unistd.h>
#include <stdio.h>
#include <fstream.h>
#include <strstream.h>
...
void TImage::PrintIt(const char *cmd) const
{
   ...
   FILE *lp_pipe;
   lp_pipe = popen(cmd, "w");
   if (lp_pipe) {
      ...
      __gnu_cxx::stdio_filebuf *lp_buf = 
                new __gnu_cxx::stdio_filebuf(lp_pipe);
      ostream lp_out((streambuf*)lp_buf);
      ...
      lp_out.flush();
      delete lp_buf;
      pclose(lp_pipe);
   }
   ...
}


Any help will be appreciated




--- Claudio Bley <bley@CS.uni-magdeburg.de> wrote:
> On Thu, Feb 19, 2004 at 11:22:50AM -0800, Kevin
> Stedman wrote:
> > I just upgraded to RedHat v. 9.? It delivers gcc
> 3.2.2
> > with it.? When I am compiling code I get the
> message
> > "stdiostream.h:? no such file or directory".?
> Where
> > did this library go.? Is there a replacement for
> it
> > ?
> > I founf a copy in the g++-3 directory, but htis
> causes
> > even more errors.? I am trying to use the stdiobuf
> > class from this.? Is there a replacement for this?
> 
> Have a look at ext/stdio_filebuf.h
> 
> HTH
> -- 
> Claudio Bley                                 ASCII
> ribbon campaign (")
> Debian GNU/Linux user                         -
> against HTML email  X 
> http://www.cs.uni-magdeburg.de/~bley/               
>      & vCards / \


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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

* Re: Help with stdiostream.h
  2004-02-20 14:37   ` Kevin Stedman
@ 2004-02-20 21:58     ` Claudio Bley
  0 siblings, 0 replies; 4+ messages in thread
From: Claudio Bley @ 2004-02-20 21:58 UTC (permalink / raw)
  To: gcc-help, kstedman9

[I already sent a message to the mailing list but it got rejected 
 as spam. So, this is my second try and I thought I'd just include
 you in the To: list]
 
On Fri, Feb 20, 2004 at 06:36:24AM -0800, Kevin Stedman wrote:
> Is there an example someplace on how this is used.  I
> am getting errors trying to compile the code below on
> the line that uses the stdio_filebuf.
> 
> when i compile I get these error msgs:
> 
> 'lp_buf' undeclared
> 
> parse error before 'lp_pipe'

Obviously, you haven't read the comment in the header and you failed to
realize that stdio_filebuf is a template class.

Try this:

----------------------------------------------------------------------

#include <iostream>

#include <ext/stdio_filebuf.h>

#include <cstdio>
#include <unistd.h>

typedef __gnu_cxx::stdio_filebuf<char> stdiobuf;


using namespace std;

int main()
{
   FILE* p = popen ("cat", "w");
   
   if (p != NULL) 
     {
	stdiobuf p_buf (p, ios::out);
	
	ostream p_out (&p_buf);
	
	p_out << "foo\n" << "foo\n" << "bar\n" ;
	
	p_out.flush ();
	
	pclose (p);
     } else {
	cerr << "failed to open pipe." << endl;
     }
}

----------------------------------------------------------------------

HTH
-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux user                         - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \

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

end of thread, other threads:[~2004-02-20 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-19 19:22 Help with stdiostream.h Kevin Stedman
2004-02-19 23:13 ` Claudio Bley
2004-02-20 14:37   ` Kevin Stedman
2004-02-20 21:58     ` Claudio Bley

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).