Enregistrement sous fichier
Bonjour tout le monde,
J'ai un petit problème en C.J'enregistre des données (RegBinaryClass) dans la base de registre. je voudrais en plus de cet enregistrement permettre a l'utilisateur d'enregistrer ces données directement dans un fichier .bin. Avec donc une boîte dialogue lui permettant de nommer le fichier et de le placer ou bon lui semble. J'ai essayé d'utiliser la classe SaveFileDialog mais je n'y arrive pas.Es-ce que quelqu'un pourrait m'aider car je suis bloqué.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
else
{
//write the data directly to the registry
RegBinaryClass lRegDataPlugRawBytes;
// Calculate the checksum
lData[0] = mCalculateChecksum(&lData[1], aDataplugIni.aLastByteAddress);
AASSERT( lData != NULL );
if ( lData != NULL )
{
if(lRegDataPlugRawBytes.mInit( REG_KEY_BASE_NPEN_DATAPLUG_FOLDER, REG_KEY_NAME_NPEN_DATAPLUG_CONTENT, aDataplugIni.aLastByteAddress + 1 , (const LPBYTE)lData ), aDataplugIni.aLastByteAddress + 1)
{
lRegDataPlugRawBytes.mSetBinaryValues( (LPBYTE)lData, aDataplugIni.aLastByteAddress + 1 );
if(!(lRegDataPlugRawBytes.mWriteValue()))
{
MessageBox(strcat((char*)aDataplugIni.aErrorEntry.c_str(), "\nmWriteValue() failed"), "Error Writing to the registry", MB_ICONERROR | MB_OK);
}
}
else
{
MessageBox(strcat((char*)aDataplugIni.aErrorEntry.c_str(), "\nmInit() failed"), "Error Writing to the registry", MB_ICONERROR | MB_OK);
}
}
else
{
MessageBox(aDataplugIni.aErrorEntry.c_str(), "Error Writing to the registry", MB_ICONERROR | MB_OK);
}
} |
Merci d'avance pour vos aides et conseils.