Convert an object to a string? (C++)
Community Forums/General Help/Convert an object to a string? (C++)
| ||
I want to do this:Vec3 v; Print( "Printing Vec3:" ); Print( v ); My Print() command takes a string. I added an operator to the Vec3 class: Vec3::operator string() { char buf[1024]; Print("calling string operator"); sprintf(buf,"%f, %f, %f",x,y,z); return string(buf); } The compiler does not like this. What is the proper way to do this? |
| ||
I got it working. I just needed a clean build. |
| ||
I told you :P |