Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-06-06 17:15:10


on 5/30/01 4:50 PM, Joel Young at jdy_at_[hidden] wrote:

[SNIP query about C-based streams and response about more_io]
> I tried the icstream class in more_io however it does not seem to
> support streams (no seek?)

What do you mean by streams? The cstream classes should support every I/O
operation, including seeking.

> The following code performs identically:
>
> int pipe_out[2];
> pipe(pipe_out);
>
> ...
>
> FILE* outstream = fdopen(pipe_out[0], "r");
> FILE* outstreama = fopen("./extr","r");
>
> char temp[512];
> while(fscanf(outstream,"%s", temp) != EOF)
> std::cerr << "Got ["<< temp << "]" << std::endl;
> while(fscanf(outstreama,"%s", temp) != EOF)
> std::cerr << "Got ["<< temp << "]" << std::endl;
>
> I get identical output.
>
> However, with:
>
> int pipe_out[2];
> pipe(pipe_out);
>
> ...
>
> FILE* outstream = fdopen(pipe_out[0], "r");
> FILE* outstreama = fopen("./extr","r");
>
> boost::icstream results(outstream);
> boost::icstream resultsa(outstreama);
>
> std::string tempa;
>
> while(results>>tempa) {
> std::cerr << "aGot [" << tempa << "]" << std::endl;
> }
> while(resultsa>>tempa) {
> std::cerr << "bGot [" << tempa << "]" << std::endl;
> }
>
> I only get data from resultsa.

What do you mean by this? Is the string from "results" blank?

> I am using gcc 3.1 branch (20010511 snapshot) on Solaris 2.8. With
> gcc 2.95.3, it doesn't even come close to building because of the
> missing headers.

What missing headers? I don't think we guarantee operation with compilers
still in beta.

> Also it has identical behavior with SUNWspro6.0. (after removing the
> inlines on the constructors)
>
> Any suggestions?

I don't have any suggestions for why the results would be different.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk