c++ - Convert a string with various float numbers into floats. -
i have series of strings "50 50 10"
each number supposed represent x, y, , z values of origin. want convert each number of string actual float.
i tried using atof, gave me first number, 50 in case.
any ideas?
thank you!
use istringstream,
int main() { string s = "50 50 50"; istringstream instream; instream.str(s); double a, b, c; instream >> >> b >> c; return 0; }
Comments
Post a Comment