getline() and a '\0' as a delimiter

C

Chris Coleman

Hi,

As some background, I have implemented a new stream object to work with
tcp socket streams. I derive a new socket stream from basic_streambuf.
I then derive a my sream object from my implemntation of basic_streambuf
and from basic_iostream.

I am then using the function getline. This works fine using '\n' or any
other character as the delimiter for getline().

eg.
TCPSockSteam mySockStream;

//send some request
....

//get thre response
std::string str;
geline(mySockStream, str, '\n');

However, the peer I am working with is a Macromedia Flash based XML
socket aplication. These terninate their messages with a closing '\0'
character, so it would be nice to use getline to read a line from the
beginning until a '\0' is reached (much the same as '\n' but with '\0')

However, when I try and use code as below:

geline(mySockStream, str, '\0');

the message is never recieved. My knowlege of the iostream libraries
internal mechanics is not great, so I guess what I'm asking is how they
deal with '\0' in the context of getline and streams. I'm guessing from
the above not the same as other non-null characters...

Any help is much appreciated.

Cheers
Chris
 
C

Chris Coleman

Apologies - a nights sleep and all has worked out fine.

Sorry for wasting anyones time...

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top