不难啊,只是麻烦。用fscanf就行了

解决方案 »

  1.   

    敬请给一些详细的资料:[email protected]
    谢谢
      

  2.   

    solar(int argc,char**argv)说的也没错啊。
    要不你就用CStdioFile,CString来处理也行啊。
      

  3.   

    我是刚接触vc的,装了vc后,照着书上的例子做,要拉控件,却看不到控件列表,可否告诉我在哪啊,是不是藏起来了, 
      

  4.   

    在工具栏上点右键,可以找倒control列表
      

  5.   

    假设你的文件为D:\test.dat,下面的代码读取并拆分字符串
    #include <iostream>
    #include <fstream>using namespace std;int main()
    {
    ifstream ifile("d:\\test.dat",ios::in | ios::out);
    if(!ifile.fail())
    {
    char buf[256];
    char *start;
    char *name;
    char *value;
    cout<<"name\tvalue"<<endl;
    cout<<"----\t----"<<endl;
    while(!ifile.eof())
    {
    ifile.getline(buf,256);
    start=buf;
    while(1)
    {
    name=start;
    if(name==0 || *name=='\0')
    break;
    value=strchr(name,'#');
    if(value==0)
    break;
    *value='\0';
    value++;
    start=strchr(value,',');
    if(start==0)
    break;
    else
    {
    *start='\0';
    start++;
    cout<<name<<"\t"<<value<<endl;
    }
    }
    } ifile.close();
    }
    return 0;
    }
      

  6.   

    我还是没有找到,点右键后出现的是output ,workspace ,standard,Alt,edit,等,没有control列表,麻烦你了,谢谢
      

  7.   

    文本文件一定会有/n换行符的,用fgets(),可以读出每一行的字符。
    if ((fSource = fopen(m_files, "r")) == NULL)
    {
    AfxMessageBox("Error! Can't open the Source Data File.");
    }
    char buf[1024];
    while (fgets(buf,1024,fSource) != NULL)
    {
                ……
    }
    可以用sscanf()函数对buf的内容进行转换。
    也可以将buf的内容赋值给一个CString变量,用find(),insert(),等等对字符串操作。具体使用可以看msdn。