#include <iostream>
#include <fstream>
#include <ctype.h> // 'isdigit', but i have yet to use it
usingnamespace std;
int main ()
{
char myName[5];
int myNumber;
ifstream myFile;
myFile.open("file.txt");
myFile.get(myName,5);
//here is the problem
myFile.get(myNumber);
cout << "My name is " << myName << " : " << myNumber << ".\n";
return 0;
}
Get a char, check if it is a digit. If yes, subtract '0' from it, store it somewhere and repeat. That way you'll get all digits of a number. It's simple to build a number from its digits (you don't even need the temporary array really).
Though there is no reason why you would want to do that. Operator >> does that for you.