15 #define _GNU_SOURCE 1 // for ::getline
35 namespace externalprogram {
37 ExternalDataSource::ExternalDataSource (FILE *ifile, FILE *ofile)
58 bool success = fwrite (buffer, length, 1,
outputfile) != 0;
70 DBG <<
"send (" << s <<
")";
71 return send(s.data(), s.length());
80 std::ostringstream datas;
84 if (readc == EOF)
break;
86 if ((
char)readc == c)
break;
98 return fread (buffer, 1, length,
inputfile);
112 int flags = ::fcntl(fd,F_GETFL);
118 flags = flags | O_NONBLOCK;
119 else if(flags & O_NONBLOCK)
120 flags = flags ^ O_NONBLOCK;
122 flags = ::fcntl(fd,F_SETFL,flags);