Goal: To be able to send the data to the pipe after serializing using msgpack(have attached the link to the header files).
insert
Code:
LPDWORD lpNumberOfBytesWritten = 0;
CStringA strEvalResultW= "abcdefghijklmnopqrstuwxyz";
//// serialize the object into the buffer.
//// any classes that implements write(const char*,size_t) can be a buffer.
std::stringstream buffer;
msgpack::type::tuple<std::string, std::string> src("SECURITY_BASELINE_BLOB", (LPCSTR)strEvalResultW);
msgpack::pack(buffer,src);
printf("\n\nThe length of the string is %ld \n\n", strlen(strEvalResultW));
BOOL result = WriteFile(hPipe, (LPCVOID)buffer.str(), strlen(buffer), lpNumberOfBytesWritten, NULL);
if (result) {
printf("\Successfully wrote to the pipe \n");
}
I am fairly new to unicode in c++ and very confused about why I am not getting the right arguments for writeFile..(I am trying to write to a pipe and have been able to connect to the pipe successfully, hPipe is the handler to the pipe).
I want to be able to send the packed data(using msg pack available at NuGet Gallery
| msgpack-c 0.5.9.1 ) to the pipe. Any help will be really appreciated and I am willing to provide more details if needed. I am not too sure of the highlighted code as well. The highlighted code in writeFile is failing.