sharpchain sharpchain - 1 month ago 5
C++ Question

Variable type with MoveFile() in VC++

So I am trying to move a file that the user specifies by using cin and MoveFile(). But the thing is MoveFile() parameters take LPCTSTR variables but cin doesnt take those variable types can anyone help me with a conversion from a char myChars[] table to a LPCTSTR variable? Any help is appreciated.


LPCTSTR is a typedef. It's actually another type: It's a long pointer to a const TCHAR string. Or, in other words, it's a const TCHAR*.

A TCHAR is also a typedef, but it's either a char or a wide character, depending on whether your project is using Unicode or ASCII. They usually default to Unicode.

You can use MoveFileA to force ASCII. Then, a LPCTSTR is literally a const char*.