|
Client code usage#ifndef FILEMM_streambuf # include <filemm/streambuf.hh> #endif Then, one can declare a new filemm:streambuf object, initialising it with a FILE pointer:
int main(int argc, char** argv) { filemm::streambuf sb(fopen(argv[1], "r")); This streambuf object can now be passed to a regular istream object, and we can operate on it as any other stream:
std::istream in(&sb); while (true) { std::string line; std::getline(in, line); if (in.eof()) break; std::cout << line << std::endl; } We can also operate on the strembuf object using C functions: fclose(sb);
return 0;
}
Last update Wed Apr 13 07:51:08 2005 Christian Holm Created by DoxyGen 1.4.2 |