You may use the
std::getline[
^] function, for the purpose, for instance, the following program tries to do it with the
"foo.txt" file
int main()
{
ifstream ifs("foo.txt");
while (ifs.good())
{
string line;
getline(ifs, line);
for (int n = 0; n < line.length(); ++n)
{
char c = line[n];
if ( isalpha(c) )
PrintCharacter(c);
else
cout << c;
}
cout << endl;
}
}