a,b,c都是指针,没有分配内存,怎么可以存数据呢
参数也传的不对

解决方案 »

  1.   

    a=(unsigned long*)malloc(20);
    b=....
    c=....用完后再free(..)就行了!
      

  2.   

    /*
     * read a UINT from the profile, or return default if
     * not found.
     */
    UINT mmGetProfileInt( LPCTSTR pstrAppName, LPCTSTR pstrValueName, UINT uDefault )
    {
    CString strName;
        HKEY hkey;
        DWORD dwType;
        UINT value = uDefault;
        DWORD dwData;
        DWORD cbData; strName.Format( _T("%s%s"), KEYNAME, pstrAppName );
        if( RegOpenKey( ROOTKEY, strName, &hkey ) != ERROR_SUCCESS )
            return(uDefault);    cbData = sizeof(dwData);
        if( RegQueryValueEx(
            hkey,
            _T("Space"),
            NULL,
            &dwType,
            (PBYTE) &dwData,
            &cbData) == ERROR_SUCCESS )
    {
    if( dwType == REG_DWORD )
    value = (UINT)dwData;
        }    RegCloseKey(hkey);    return(value);
    }/*
     * write a UINT to the profile, if it is not the
     * same as the default or the value already there
     */
    VOID mmWriteProfileInt( LPCTSTR pstrAppName, LPCTSTR pstrValueName, UINT uValue, UINT uDefault )
    {
    CString strName;
    HKEY hkey;
    DWORD dwData = uValue;

        if( mmGetProfileInt( pstrAppName, pstrValueName, uDefault ) == uValue )
            return;

    strName.Format( _T("%s%s"), KEYNAME, pstrAppName );
    if( RegCreateKey( ROOTKEY, strName, &hkey ) == ERROR_SUCCESS )
    {
    RegSetValueEx(
    hkey,
    pstrValueName,
    0,
    REG_DWORD,
    (PBYTE) &dwData,
    sizeof(dwData)
                );

    RegCloseKey(hkey);
    }
    }