Manipulation of C-style strings?

closed account (jE8qM4Gy)
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?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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));

}
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,


It is not at all clear what you're trying to do here. Perhaps a sample input and expected output for that input would help.
Topic archived. No new replies allowed.