我第一次用,请问各位哥哥姐姐怎么来读取配置文件,
举个例子:
或推荐 好书。文章。
谢谢

解决方案 »

  1.   

    Registry Functions
    The following functions are used with the registry:   
     
    RegCloseKey  
    RegConnectRegistry  
    RegCreateKey  
    RegCreateKeyEx  
    RegDeleteKey  
    RegDeleteValue  
    RegEnumKey  
    RegEnumKeyEx  
    RegEnumValue  
    RegFlushKey  
    RegGetKeySecurity  
    RegLoadKey  
    RegNotifyChangeKeyValue  
    RegOpenKey  
    RegOpenKeyEx  
    RegQueryInfoKey  
    RegQueryMultipleValues  
    RegQueryValue  
    RegQueryValueEx  
    RegReplaceKey  
    RegRestoreKey  
    RegSaveKey  
    RegSetKeySecurity  
    RegSetValue  
    RegSetValueEx  
    RegUnLoadKey  
    Obsolete Functions
      
     
    GetPrivateProfileInt  
    GetPrivateProfileSection  
    GetPrivateProfileSectionNames  
    GetPrivateProfileString  
    GetPrivateProfileStruct  
    GetProfileInt  
    GetProfileSection  
    GetProfileString  
    WritePrivateProfileSection  
    WritePrivateProfileString  
    WritePrivateProfileStruct  
    WriteProfileSection  
    WriteProfileString  
     
      

  2.   

    --->to:syy64(太平洋) 
    这都是什么啊,今天我是第三天学vc,再简单的还有吗。谢谢
      

  3.   

    你在google里搜索一下别人的例子照着改吧,让你直接写估计也很难,才三天,我晕!
      

  4.   

    GetPrivateProfileInt
    GetPrivateProfileSection
    GetPrivateProfileSectionNames
    GetPrivateProfileString
    GetPrivateProfileStruct    
    //----------------------读配置文件
    WritePrivateProfileSection
    WritePrivateProfileString
    WritePrivateProfileStruct
    WriteProfileSection
    WriteProfileString      
    //-----------------------写配置文件
    具体用法看msdn
      

  5.   

    http://blog.csdn.net/lixiaosan/archive/2004/10/28/156609.aspx
      

  6.   

    int main()
    {

    int m_nXPos=GetPrivateProfileInt("SECTION 1", //节名
    "XPos", //项名
    0, //没找到此项时的缺省返回值
    "F:\\vc-piezhi\\xuexipeizhi\\test.ini"); //配置文件的准确路径

    int m_nYPos=GetPrivateProfileInt("SECTION 1","YPos",0,"F:\\vc-piezhi\\xuexipeizhi\\test.ini");
    char buf[256];
    int len=GetPrivateProfileString("SECTION 2", //节名
    "Text", //项名
    "No Text", //没找到此项时的返回值
    buf, //目标缓冲区地址
    256, //目标缓冲区长度
    "F:\\vc-piezhi\\uexipeizhi\\test.ini"); //配置文件的准确路径printf("%d\n",m_nYPos);
    printf("%s\n",buf);
     return 0;
    }
    -------配置文件----------
    [SECTION 1]
    XPos=300
    YPos=200[SECTION 2]
    Text=Hello
    -----------------------为什么打印是No Text呢??不应是hello吗?而m_nYPos 返回200正确