I want to use HttpSendRequest function that takes as 4th parameter a LPVOID.
My need is to read a binary file and pass its content as LPVOID.
I found a function that reads binary file as std::string, but I have no solution to pass this std::string as LPVOID. Here is that function :
string CSslConnection::GetFileContents(const string &filename)
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ , 0, NULL, OPEN_EXISTING, 0, NULL);
assert(hFile != INVALID_HANDLE_VALUE);
DWORD dwFileSize = GetFileSize(hFile, NULL);
char *p = (char *)malloc(dwFileSize);
ReadFile(hFile, p, dwFileSize, &dwBytesRead, NULL);
I tried to convert the std::string returned by GetFileContents to a char * using c_str function, but the char * obtained is corrupted.
Any help would be much appreciated.