I trying to read data from a file to a c-string, then go through the string and convert the ascii chars to 5 to 6 digits numbers, but im having trouble.
The file looks looks like this: computer technology are part of just about everything...and so on
I've already read it to the c-string but how do I the ascii to 5-6 digits numbers?
Here's the code: What am I doing wrong?
Code:
void CheckArray(char inputfilename[], char charStringValue[])
{
// initialize variables
ifstream input;
char x;
int index;
int size;
int y = 0;
input.open(inputfilename);
input >> charStringValue[x];
while (input.good()) {
cout << DecodeChar(charStringValue[x]) << " ";
input >> charStringValue[x];
}
int DecodeChar(char c) {
return (int (c - 32));
}