This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re:pfstream ?

[Get raw message]
Benjamin Kosnik wrote:

> I don't know. What did it do? How was it used?

At the beginning of pfstream.h I found this. What do you think?

Personally, if asked to convert quickly code containing ipfstream and opfstream I would
probably cook up something using the function "system" of <cstdlib> and a temporary file.
Probably.

Cheers,
Paolo.


////////////////////////////

extern "C++" {
// ipfstream foo("NAME") is like: ifstream foo("NAME").  However,
// if NAME starts *or ends* with a '|', the remainder of NAME is
// evaluated as a shell command (using a procbuf), and all input
// read from foo is whatever that shell writes to its standard output.
// E.g. ipfstream foo("|zcat foo.Z") or ipfstream foo("zcat foo.Z|")
// (These two forms are equivalent.)

class ipfstream : public ifstream {
  public:
    ipfstream(const char *name, int mode=ios::in, int prot=0664);
};

// opfstream foo("NAME") is like: ofstream foo("NAME").
// However, if NAME starts with a '|', the remainder of NAME is
// evaluated as a shell command (using a procbuf), and all output
// written to foo is piped to the standard input of that shell.
// E.g. opfstream foo("|more");

class opfstream : public ofstream {
  public:
    opfstream(const char *name, int mode=ios::out, int prot=0664);
};
} // extern "C++"




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]