Hi guys, its me again..
I was wondering if anyone could tell me how to test a character if it is within the ASCII range, like say in the following pseudocode:
ifstream in;
in.open("file.xxx", ios::binary);
if(!in)
{
cerr << "file.xxx could not be opened. \n";
}
while (!in.eof())
{
char c = in.get();
if (c > 127) // not working, not detecting if file is ascii or binary
{
cout<< "file.xxx is non-ASCII binary.\n";
break;
}
else
{
cout << "file.xxx is ASCII binary (text). \n";
break; // how do i do it so that this break condition is only executed when end of file has been reached without any characters outside the ASCII range?
}
}
inFile.close();