Read file name at console and pass to CreatFile
Hi,
I'm working on a C COM/.Net application which requires the use of char and widechar types. One problem I have is to pick-up the name of a file as character (char mandatory) from the console and pass it to CreateFile(), which requires a widechar of LPCTSTR type. I've used the mbstowcs() function, I did all the checks with what I enter and what I get, it gives me back a wrong file handle from CreateFile() (error 123 - file length issue). If I initialize the file name in code - as char - then use the conversion, it works. Therefore there is a problem with the console read, but it's strange. Any idea? Many thanks!