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