《C/C++程序员实用大全》配套代码,适用初学C++的人员。
源代码在线查看: chk_eof.cpp
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
if(argc!=2)
{
cout exit (1);
}
ifstream in(argv[1], ios::in | ios::binary);
if(!in)
{
cout exit (1);
}
register int i, j;
int count = 0;
char c[16];
cout.setf(ios::uppercase);
while(!in.eof())
{
for(i=0; i in.get(c[i]);
if(i i--;
for(j=0; j < i; j++)
cout for(; j < 16; j++)
cout cout for(j=0; j < i; j++)
if(isprint(c[j]))
cout else
cout cout count ++;
if(count==16)
{
count = 0;
cout cin.get();
cout }
}
in.close();
}