Problem using boost::asio::ip::address::from_string
Hello boost-users, I'm using boost::asio::ip::address in a client-server application and i'm having a strange behaviour when using the member method *from_string*. The method isn't working correctly(or doing any work at all), since after calling it, nothing changes. Bellow there's a code that reproduces the problem. #include <boost/asio.hpp> #include <iostream> int main() { char ip[15]; printf("type ip please\n"); std::cin >> ip; boost::asio::ip::address a; printf("address1 before member method is called %s\n", a.to_string().data()); a.from_string(ip); boost::asio::ip::address b(a); printf("address1 %s from string %s\n", a.to_string().data(), ip); printf("address2 %s from address1 %s\n", b.to_string().data(), a.to_string().data()); return 0; } Can anyone see what is possibly wrong with the code? Thanx in advance! -- Matheus Araújo Aguiar Computer Scientist matheus.pit@gmail.com
I'm using boost::asio::ip::address in a client-server application and i'm having a strange behaviour when using the member method *from_string*. The method isn't working correctly(or doing any work at all), since after calling it, nothing changes. Bellow there's a code that reproduces the problem.
Note that from_string is a *static* function that creates and returns address obect: http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/ip__addre... boost::asio::ip::address a = boost::asio::ip::address::from_string(ip);
indeed. my bad sorry, i should read the reference more carefully. Thanx Igor! On Tue, Jun 16, 2009 at 2:48 PM, Igor R <boost.lists@gmail.com> wrote:
I'm using boost::asio::ip::address in a client-server application and i'm
having a strange behaviour when using the member method *from_string*. The method isn't working correctly(or doing any work at all), since after calling it, nothing changes. Bellow there's a code that reproduces the problem.
Note that from_string is a *static* function that creates and returns address obect:
http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/ip__addre...
boost::asio::ip::address a = boost::asio::ip::address::from_string(ip);
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Matheus Araújo Aguiar Computer Scientist matheus.pit@gmail.com
participants (2)
-
Igor R
-
Matheus Araújo Aguiar