AA BB CC DD EE FF AA BB CC DD EE FF AA BB CC DD EE FF AA BB CC DD EE FF
文本里面的数据是这样的,怎么用vc编啊,菜鸟求教,最好给代码

解决方案 »

  1.   

    #include <stdio.h>FILE *stream;int main( void )
    {
       float fp;
       int xx;   stream = fopen( "fscanf.file", "r" );
       if( stream == NULL )
          printf( "The file fscanf.out was not opened\n" );
       else
       {
          fscanf( stream, "%x ", xx );
          fclose( stream );
       }
    }
      

  2.   

    不好意思,更正一下fscanf( stream, "%x ", xx );
    ->fscanf( stream, "%x ", &xx );
      

  3.   

    #include <vector>
    using namespace std;try
    {
    CFile file;
    file.Open(_T("F:\\11.txt"), CFile::modeRead);
    int len = (int)file.GetLength();
    char* szBuf = new char[len+1];
    memset(szBuf, 0, sizeof(char)*(len+1)); file.Read(szBuf, len);
    file.Close(); CString strText(szBuf);
    delete szBuf;

    LPCTSTR szToken = _T(" ");
    int curPos = 0;
    CString strToken = _T(""); vector<float> vec;
    vec.clear(); while(_T("") != (strToken = strText.Tokenize(szToken, curPos)))
    {
    float ftmp = (float)_tcstoul(strToken, NULL, 16);
    vec.push_back(ftmp);
    } CString strMsg(_T(""));
    CString strTmp(_T("")); for(vector<float>::const_iterator iter = vec.begin(); iter != vec.end(); iter++)
    {
    strTmp.Format(_T("%f"), *iter);
    strMsg += strTmp + _T("\r\n");
    }
    AfxMessageBox(strMsg);
    }
    catch (CFileException* e)
    {
    e->ReportError();
    e->Delete();
    }
      

  4.   

    11.txt的内容为:
    AA BB CC DD EE FF AA BB CC DD EE FF AA BB CC DD EE FF AA BB CC DD EE FF
      

  5.   

     编译有错误,不知道怎么回事error C2039: 'Tokenize' : is not a member of 'CString'
            c:\program files\microsoft visual studio\vc98\mfc\include\afx.h(368) : see declaration of 'CString'
     fatal error C1903: unable to recover from previous error(s); stopping compilation
    执行 cl.exe 时出错.