I'm quite sure that it is a stupid issue but it drives me crazy..
how could i print on the console a TCHAR array?
DWORD error = WSAGetLastError();
TCHAR errmsg[512];
int ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, error, 0, errmsg, 511, NULL);
i need to print errmsg...
It depends on what TCHAR is. If you compile with Unicode enabled, TCHAR is defined as wchar_t. Then you can use std::wcout, for example:
std::wcout << L"Error: " << errmsg << '\n';
If Unicode is not enabled, TCHAR is an ordinary char and you can use the ordinary std::cout:
std::cout << "Error: " << errmsg << '\n';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With