title: Reading a Unicode file in C and passing contents as ASCII via sockets
body: <p>I've being trying to figure this out, but nothing seems to work. We have an application
  that reads thousands of transactions files using the normal "fopen fgets etc", which we parse using normal C functions "strstr, strchr, etc" and return back a normalized char *.</p>
  
  <p>However, now we need to read some files that are in Unicode (from Windows) and I am having a lot of trouble. From what I am working on, I only receive a FP (file pointer) without knowing if the FP points to a normal ascii file or Unicode and I need to send back to the application as char *.</p>
  
  <p>I also can not run command line tools to manually convert the whole file, because we are tailing it for new entries.</p>
  
  <p>I tried using WideCharToMultiByte, mbsrtowcs, but it seems that after I read the file using fgets, and pass to them, the return is always empty (0 bytes). Anyone have any example on how to do it properly? The online docs/manuals for these functions all miss good examples.</p>
  
  <p>Thanks!</p>