G
Guest
There are two methods of snagging a 'line' from a stream (with an attached
streambuf that reads/writes from a socket).
One is the std function "getline" and the other is the "getline" method of
the stream itself. Silly the stream only takes a char_type buffer when the
'std::getline()' takes a bonafide string reference!
I prefer the one that takes the basic_string ref. Here's the dilema with
this approach, I don't know how to test for EOF. Using the iostreams
getline method it returns '0' or something to that effect on EOF. Please
advise!
This is a little less related to IOStreams themselves but since I've
encountered this within the same context I hope this goes over at least
midly well.
This is a problem that is only happening to me on the Windows platform (try
not to think of this as a Windows specific issue -- I'm trying to understand
C++ techniques for C practices.). I'd like to know a C++ programmer accepted
way of removing the trailing '\r' from the result of one of the getline
formats. I don't want to assume the '\r' is there so I'd appreciate some
options. I have heard that it's supposed to be handled by the CRT of the
platform if I open the stream in text mode. Well I see only a binary mode
setting for the stream.
I'm still working through "Standard C++ IOStreams and Locales" so perhaps
the answers are there. I'd still appreciate any pointers.
ty~
streambuf that reads/writes from a socket).
One is the std function "getline" and the other is the "getline" method of
the stream itself. Silly the stream only takes a char_type buffer when the
'std::getline()' takes a bonafide string reference!
I prefer the one that takes the basic_string ref. Here's the dilema with
this approach, I don't know how to test for EOF. Using the iostreams
getline method it returns '0' or something to that effect on EOF. Please
advise!
This is a little less related to IOStreams themselves but since I've
encountered this within the same context I hope this goes over at least
midly well.
This is a problem that is only happening to me on the Windows platform (try
not to think of this as a Windows specific issue -- I'm trying to understand
C++ techniques for C practices.). I'd like to know a C++ programmer accepted
way of removing the trailing '\r' from the result of one of the getline
formats. I don't want to assume the '\r' is there so I'd appreciate some
options. I have heard that it's supposed to be handled by the CRT of the
platform if I open the stream in text mode. Well I see only a binary mode
setting for the stream.
I'm still working through "Standard C++ IOStreams and Locales" so perhaps
the answers are there. I'd still appreciate any pointers.
ty~