12 #define _GNU_SOURCE 1 // for ::getline
32 namespace externalprogram {
34 ExternalDataSource::ExternalDataSource (FILE *ifile, FILE *ofile)
55 bool success = fwrite (buffer, length, 1,
outputfile) != 0;
67 DBG <<
"send (" << s <<
")";
68 return send(s.data(), s.length());
77 std::ostringstream datas;
81 if (readc == EOF)
break;
83 if ((
char)readc == c)
break;
95 return fread (buffer, 1, length,
inputfile);
109 int flags = ::fcntl(fd,F_GETFL);
115 flags = flags | O_NONBLOCK;
116 else if(flags & O_NONBLOCK)
117 flags = flags ^ O_NONBLOCK;
119 flags = ::fcntl(fd,F_SETFL,flags);