int thetime = time(NULL);
string in;
stringstream out;
out << thetime;
in = out.str();

that's my code for casting an integer into a string, but im having a little trouble reversing it to change a string into an int. :/ can anybody help me out? you have to include the sstream library. thanks!

its nearly the same thing

string in = "123";
stringstream out;
out << in;
int thetime;
out >> thetime;

thanks :) my brain stopped working for a moment there

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.