21int main(
int argc,
char **argv)
26 string file_name =
"test_file.txt";
31 JParser<> zap(
"Example program to test file streaming.");
33 zap[
'f'] =
make_field(file_name) =
"test_file.txt";
38 catch(
const exception &error) {
39 FATAL(error.what() << endl);
45 data_in.push_back(
"hello");
46 data_in.push_back(
"world");
49 int fd = open(file_name.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666);
55 for (vector<string>::const_iterator i = data_in.begin(); i != data_in.end(); ++i) {
65 int fd = open(file_name.c_str(), O_RDWR);
71 for (
string buffer; getline(is,buffer); ) {
72 data_out.push_back(buffer);
78 if (
debug >= debug_t) {
79 cout <<
"data_in "; copy(data_in .begin(), data_in .end(), ostream_iterator<string>(cout,
" ")); cout << endl;
80 cout <<
"data_out "; copy(data_out.begin(), data_out.end(), ostream_iterator<string>(cout,
" ")); cout << endl;
83 ASSERT(data_in == data_out);