【发布时间】:2014-12-25 09:13:43
【问题描述】:
我想使用 MoveFile 函数,这个函数使用两个 LPWSTR 参数,但我有一个 char* 和 LWSTR,如何连接它们?
//move file
LPWSTR latestFile = L"test.SPL";
char* spoolFolder = "C:\\Windows\\System32\\spool\PRINTERS\\";
LPWSTR fileToMove = spoolFolder + latestFile;
BOOL moved = MoveFile(latestFile, L"C:\\UnprocessedFiles\\" + latestFile);
【问题讨论】:
-
除此之外,还有一个更根本的问题:您不能依赖 spool 文件夹始终位于该位置 - 对于初学者来说,Windows 目录可能位于另一个驱动器上。
标签: c++ windows string-concatenation lpwstr