这是相关代码:
char c;
size_t buffer_size = 0;
wchar_t* wc = (wchar_t*) malloc(buffer_size);
int result = recv(this->m_socket, &c, 1, 0);
mbstowcs_s(&buffer_size, wc, buffer_size, &c, 1); // Something is wrong here
我该如何解决这个问题?
答案 0 :(得分:1)
您为wc
分配了0个字节,并将该缓冲区传递给mbstowcs_s
。
答案 1 :(得分:0)
http://msdn.microsoft.com/en-us/library/eyktyxsx%28v=vs.80%29.aspx