atoi on a character array with lots of integers
问题 I have a code in which the character array is populated by integers (converted to char arrays), and read by another function which reconverts it back to integers. I have used the following function to get the conversion to char array: char data[64]; int a = 10; std::string str = boost::lexical_cast<std::string>(a); memcpy(data + 8*k,str.c_str(),sizeof(str.c_str())); //k varies from 0 to 7 and the reconversion back to characters is done using: char temp[8]; memcpy(temp,data+8*k,8); int a =