15 #include "cl_spushstring.h"
17 #if ((defined(__sparc__) || defined(__rs6000__) || defined(__mips__)) && !defined(__GNUC__))
18 // Sun C++ doesn't have istream::unget() and istream::set().
19 #define unget() putback(c)
20 #define set(x) setf(x)
23 const cl_string cl_fgetline (cl_istream stream, int n, char delim)
25 var cl_spushstring buffer;
26 // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.get()==EOF).
27 while (stream.good()) {
28 var int c = stream.get();
30 break; // ios::eofbit already set
35 #if defined(__GNUG__) && (__GNUC_MINOR__ < 8)
36 stream.set(ios::failbit);
38 stream.setstate(ios::failbit);
44 return buffer.contents();