|
Boost Users : |
Subject: Re: [Boost-users] string comparison
From: Igor R (boost.lists_at_[hidden])
Date: 2010-02-10 07:48:26
> char *datos3="UNBLOCK";
> size_t len2 = socket.read_some(boost::asio::buffer(buf2), error2);
>
> Â Â Â Â datos2=(buf2.data());
>
> //and compare datos2 and datos3
>
> ost::is_equal test;
>
> Â Â if (test(datos2,datos3))
> Â { std::cout << "Equal" << endl;
> Â Â return;
> Â }
> Â else
> Â std::cout << "NO Equal" << endl;
>
> but the string in Datos2 is : UNBLOCK@ =   ��<   ,
> what i got that strange charateres?
Are you sure that you get from the socket null-terminated sequence of
characters? If it's not null-terminated, then set null-terminator
manually - or just do not use functions that expect null-terminated
strings.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net