/* ΪWindowsµĿ̨MFC֧֣ͨ룩 
* ִʱһָҪ򿪵ļÿ10ַÿַһַ 
* һпܲ10'\n','\t'ַܸıӡʽ 
*/ 

#include <iostream.h> 
#include <afx.h> 

int main(int argc, char* argv[]) 
{ 
 if (argc != 2) 
 { 
   cout << 2 << endl; 
   return 1; 
 } 

 CFile file; 
 int sucess = file.Open(argv[1], CFile::modeRead); 
 if (!sucess) 
 { 
   cout << 2 << endl; 
   return 2; 
 } 

 long length = file.GetLength(); 

 bool flag = false;         // ָǷָںֵĸλֽ 
 int count = 0; 
 unsigned char buf[21], *p = buf; 
 for (int i=0; i<length; i++) 
 { 
   if (count == 10) 
   { 
     *p = '\0'; 
     cout << buf << endl;   // ע⣺Ʒܴʾʽ 

     count = 0; 
     p = buf; 
   } 

   file.Read(p, 1); 
   count++; 
   if (*p++ > 128 && !flag) 
   { 
     count--; 
     flag = true; 
   } 
   else 
     flag = false; 
 } 
 *p = '\0'; 
 cout << buf << endl; 

 return 0; 
}