C string and c++ string doubt

Hello guys im trying to make a project where i need to create a function that if lets imagine the file 000.txt exists then create 001.txt to store data and so fourth. my doubt is how can i get this done since i need to pass an int to the filename and sum 1.
1
2
3
4
int num = 1;
std::ostringstream ss;
ss << std::setfill('0') << std::setw(3) << num;
std::string filename = ss.str() + ".txt";
http://ideone.com/1sLjLf
thanks a lot it worked out!! :D
Topic archived. No new replies allowed.