1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
// je remplie la map par un contenu de test
map<CString,vector<CString>> ma_map;
vector<CString> v; v.push_back("b");v.push_back("c");
ma_map["a"]=v;
// j'essai de passer une référence sur la map( puisque la fonction writefile prend un LPVOID comme param en entrée
BOOL bResult = WriteFile(
hPipe, // handle to pipe
&ma_map, // buffer to write from
sizeof(ma_map)+1, // number of bytes to write, include the NULL
&cbBytes, // number of bytes written
NULL); // not overlapped I/O
if ( (!bResult) || (sizeof(ma_map)+1 != cbBytes))
{
printf("\nError occurred while writing to the server: %d", GetLastError());
CloseHandle(hPipe);
return 1; //Error
}
else
{
printf("\nWriteFile() was successful.");
} |
Partager