[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tcpstream and strings
From: |
Ari Johnson |
Subject: |
Re: tcpstream and strings |
Date: |
Sat, 1 Feb 2003 19:03:37 -0600 (CST) |
This is a known feature of iostream, and tcpstream inherits from iostream
so it is to be expected. The best solution that I've found is to allocate
a buffer and use the .read() or .readline() methods. For example:
char buff[1024];
tcpstream tcp;
tcp.readline(buff, 1024); // or tcp.read(buff, 1024)
Ari Johnson
On Sun, 2 Feb 2003, [iso-8859-1] Jos? Tavares wrote:
> I know this must be a very very simple question, but here it is:
> I can send a string throw a tcpstream object using something like this
> tcpstream tcp;
> tcp << "Something like this" << endl;
>
> but when I use the same scheme to read the message (something like tcp >>
> str,
> str is a string object) and then print it out (using cout << str) only the
> first word is read. How can I resolve this?
>
> TIA,
> Jose Tavares
>
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>