hi, i'm working over a code to interchange messages using sockets, i have a server that when client connect to, server sends a char number(eg "100"), when client receives this string number, it has to addition +5 , to do that i need to change format from string to int and make sum operation, but when i do de change of format i get some error this message on the console window : bad lexical cast : source type value could not be interpreted as target Part of the code is : boost::array<char, 2> buf; boost::system::error_code error; size_t len = socket.read_some(boost::asio::buffer(buf), error); if (error == boost::asio::error::eof) break; // Connection closed cleanly by peer. std::string datos=buf.data(); int rxint; vector[2]=buf.data(); *rxint=boost::lexical_cast<int>(datos);* //(here is the problem) std::cout.write(buf.data(), len); do i making something wrong? -- Ing Pedro Alonso Chaparro Valero Ciudad Politecnica de la Innovación iTEAM - Mobile Communications Group Polytechnic University of Valencia C\ Camino de Vera S/N, Edificio 8G 46022 Valencia, Spain
participants (2)
-
Igor R
-
pedro chaparro