long aa;
CFile cfile;
....
cfile.Read(&aa, 4);

解决方案 »

  1.   

    BYTE by = 0;
    CFile file
    ........
    file.Read(&by, sizeof(BYTE));CString str;
    str.Format("0x%x", by);
      

  2.   

    先按字符读取,再转化成16进制数  strtoul
      

  3.   

    int n;
    FILE *file;
    file=fopen("aa.txt","rb");
    while (!feof(,file))
    {
    fscanf(file,"%x",&n);//n就是你要的数
    }
      

  4.   

    1.
    fulingwei(flw) 
    先按字符读取,再转化成16进制数 strtoul2.
    文件里是 ijkl     (按字符 看)
    显示出 49 4a 4b 4c 是么那就直接按字符读取..然后 %x显示就行了.char a[5]="ijkl";
    char s[20];
    sprintf(s,"0x%x  0x%x  0x%x  0x%x",a[0],a[1],a[2],a[3]);
    AfxMessageBox(s);
      

  5.   

    /**
    * 打开文件,读出数到pArr整数数组中
    * @param fileName:文件名路径
    * @param pArr:文件读出的存储数的数组,自己保证此数组足够大,此段程序没有进行数组越界处理
    */
    void GetValue( char *fileName,int *pArr )
    {
    /**
    * 打开文件
    */
    FILE * stream = fopen( fileName , "rt" );
    if( stream )
    {
    /**
    * 读入所有的有效行
    */ 
    char line[ 100 ];
    int nIndex = 0;
    const char *seps = " ";
    while( !feof( stream ) )
    {
    /**
    * 读取一行
    */
    line[ 0 ] = 0;
    fgets( line, 99, stream ); if( strlen( line ) > 0 )
    {  
    /**
    * 用空格进行分隔
    */
    char *token = strtok( line, seps );
    while( token != NULL )
    {
    /**
    * 十六进制转换为整数并放入数组pArr
    */
    char  *stopstring = NULL;
    double x =   strtod( token, &stopstring );
    pArr[ nIndex ]  = strtol( token,&stopstring,16); /**
    * 循环继续
    */
    nIndex ++;
    token = strtok( NULL, seps );
    }
    }
    } /**
    * 关闭文件
    */
    fclose( stream );
    }
    }调用示例:
       int arr[100];
        memset(arr,0,sizeof( arr) );
       GetValue("c:\\1.txt",arr );
      

  6.   

    关键是使用了strtok函数和strtol函数。
      

  7.   

    strtoul这个函数MFC可以用吗?这个好象是用于字符串转化为相对的数字吧??但是我就想用原文本的内容对代表的数字