there are several ways to convert a string of digits to an integer. One of them is by using c++ stringstream class, which is based on fstream but works on strings instead of files
#include <string>
#include <sstream>
int main()
{
char digits[] = "1234";
int x = 0;
stringstream stream(digits);
stream >> x;
cout << x << "\n";
}
And converting from int to strring is just as simple
#include <string>
#include <sstream>
int main()
{
int x = 12345;
string digits;
stringstream stream;
stream << x;
stream >> digits;
cout << digits << "\n";
}