the digits in the file have to be converted to binary when inserting them into an int array. For example the string "123" can be converted to it like this
char nm[] = "123";
int n = 0;
for(i = 0; nm[i]; ++i)
n = (n * 10) + nm[i] - '0';
you can also use scanf
char nm[] = "123";
int n = 0;
sscanf(nm,"%d",&n);
Ancient Dragon
Retired & Loving It
30,047 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342
the problem with using getline is that it doesn't separate the integers. using your example "23 1 0 55 1" there are 5 integers. but you could use extraction operator to separate them
string n;
in >> n;
int num = atoi(n.c_str());
Ancient Dragon
Retired & Loving It
30,047 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342