I understand from this and this thread that in Windows, wchar_t is 16-bit & for Linux, wchar_t is 32 bit.
I have a client-server architecture (using just pipes - not sockets)- where my server is Windows based and client is Linux.
Server has a API to retrieve hostname from client. When the client is Windows based, it could just do GetComputerNameW and return Wide-String. However, when the client is Linux based, things get messy.
As a first naive approach, I used mbstowcs() hoping to return wchar_t* to Windows server-side. However, this LPWSTR (I have typedef wchar_t* LPWSTR on my linux clinet side) is not recognizable on Windows since it expects its wchar_t to be 16-bit.
So, converting the output of gethostname() on linux - which is in char* to unsigned short (16-bit) my only option?
Thanks in Advance!