VC如何操作.ini配置文件?是哪个类?

解决方案 »

  1.   

    CWinApp Class 
    GetProfileInt:
    Retrieves an integer from an entry in the application’s .INI file. 
    WriteProfileInt:
    Writes an integer to an entry in the application’s .INI file. 
    参见MSDN
      

  2.   

    没有类,只有API:
    UINT GetProfileInt(
      LPCTSTR lpAppName,  // section name
      LPCTSTR lpKeyName,  // key name
      INT nDefault        // default value if key name not found
    );
    UINT GetPrivateProfileInt(
      LPCTSTR lpAppName,  // section name
      LPCTSTR lpKeyName,  // key name
      INT nDefault,       // return value if key name not found
      LPCTSTR lpFileName  // initialization file name
    );DWORD GetPrivateProfileString(
      LPCTSTR lpAppName,        // section name
      LPCTSTR lpKeyName,        // key name
      LPCTSTR lpDefault,        // default string
      LPTSTR lpReturnedString,  // destination buffer
      DWORD nSize,              // size of destination buffer
      LPCTSTR lpFileName        // initialization file name
    );BOOL WritePrivateProfileString(
      LPCTSTR lpAppName,  // section name
      LPCTSTR lpKeyName,  // key name
      LPCTSTR lpString,   // string to add
      LPCTSTR lpFileName  // initialization file
    );
      

  3.   

    使用writeprivateprofilestring和getprivateprofilestring就够了,当然你自己建立一个类,再把取出的字符型的数字转化为INT或者其他类型的。
      

  4.   

    就是楼上说的这几个函数,具体参数的意义看MSDN