|
-
May 5th, 2008, 06:48 PM
#1
whats wrong?
All im tryin to do is convert a text file with a list of words to the ascii equivalent. but I always get an error, "Expression: string subscript out of range". Any help would be appriciated.
int main ( )
{
ifstream fin;
fin.open ( "wordlist.txt" );
string line;
int x = 0;
while ( getline ( fin, line ) )
{
while ( x != sizeof ( line ) )
{
cout << int (line[x]);
x++;
}
cout << '\n';
}
return 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|