- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
<分区>
我很难将字符串转换为 LPWSTR
,因此我可以使用 PathStripToRoot()
函数。
MSDN 文档说我需要 LPTSTR
变量 ( http://msdn.microsoft.com/en-us/library/windows/desktop/bb773757(v=vs.85).aspx ),但是 Visual Studio 2013 说我需要 LPWSTR
。
这是我的函数的代码片段:
fileStat fileCreate(const string& targetFile)
{
fileStat filez;
fstream file(targetFile.c_str());
if (!file)
{
cout << "File does not exist" << endl;
}
std::ifstream in(targetFile, ios::binary | ios::ate);
int a = in.tellg();
cout << "File size(bytes): " << in.tellg() << endl << endl;
file.close();
wstring stemp = strChange(targetFile);
LPCWSTR result = stemp.c_str();
/* Tried the below code but that did not work
LPWSTR ws = new wchar_t[targetFile.size() + 1];
copy(targetFile.begin(), targetFile.end(), ws);
ws[targetFile.size()] = 0;
*/
cout<<"\n\n"<<PathStripToRoot(ws)<<"\n\n";
...
filez.fileSize = a;
return filez;
}
很多人都说要使用 MultiByteToWideChar()
函数,但我查看了 MSDN 文档,却不知道它是如何工作的。有没有比使用 MultiByteToWideChar()
更简单的方法?
我在将值转换为 LPWSTR 时遇到困难。我正在获取一个注册表值,并尝试将结果作为 LPWSTR 返回。看起来使用 RegQueryValueExW 的注册表调用适用于各种类型来存储结果,但我无法将它
我正在按照本教程在 Windows 中进行串行通信 (http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/
编译C++项目时出现以下错误。 Error C2664 'BOOL CryptBinaryToStringW(const BYTE *,DWORD,DWORD,LPWSTR,DWORD *)': ca
我有一个函数,它只接受一个 LPWSTR 作为参数。但是,我需要在它的末尾添加整数。 这是一个示例伪代码: int theNumber = 5; LPWSTR myLPWSTR = L"Number
好的,我的程序有问题。我之前提出过一个问题,但没有人真正理解我的问题,所以这次我尝试了一种新的方法。 如果你好奇这是我的问题: My program takes arguments in the fo
这个问题在这里已经有了答案: How to convert std::string to LPCWSTR in C++ (Unicode) (6 个答案) 关闭 8 年前。 我很难将字符串转换为 L
我正在尝试初始化 MENUITEMINFO 以调用 InsertMenuItem。尝试将 const 字符串分配给 dwTypeData 时,出现错误。以下代码来自 MSDN 示例。 两种类型的赋值都
我很少直接使用Windows API,但我遇到了一种不可避免的情况,我不知道如何处理它。 MS API 文档引用了 API 调用的参数,例如 out Something LPWSTR 所以我显然必须提
我正在尝试编码一个如下所示的 C++ 结构: typedef struct _SOME_STRUCT { DWORD count; LPWSTR *items; } “items”
我正在替换一个旧的 DLL,它有一个函数,通过引用传递一个 LPWSTR。这些函数应该创建一个新的 wchar 缓冲区并返回新创建的 LPWSTR 指针。我找到了解决方案,但我认为它可以更好地解决!?
我正在使用 WinAPI GetLogicalDriveStrings() 需要 LPWSTR 的函数并且想知道是否有更安全的方法来确保没有内存泄漏。 目前我构造了一个指向缓冲区的初始指针 buf使用
我正在尝试使用 cmd.exe 执行一些操作,但我想隐藏 cmd.exe。当我尝试使用完整路径而不是 cmd.exe 时,我总是会收到此错误: char Process[] = "C:\\WINDOW
我有一个 LPWSTR 类型的变量,其中包含 "true" 或 "false"。有没有一种方法可以将其转换为具有 true 或 false 的 bool 类型的变量? 理想情况下我想做这样的事情: F
我已经使用 wstringstream 构建了一个字符串,需要将其分配给类型为 LPWSTR 的 struct 成员。我尝试使用 my_stringstream.str().c_str() 但出现以下
根据我的理解(如果我错了请纠正我),它们之间的唯一区别是字符串是否可以被调用的函数修改。 ( PCWSTR , LPWSTR ) 我现在正尝试将字符串从 C# 传递到需要 PCWSTR 的函数,但我能
在 Visual C++ 中,我有一个 LPWSTR mystring; 它已经在代码的其他地方定义了。 我想创建一个新的 LPWSTR 包含: "hello " + mystring + " bla
作为一个 C++ 新手,我似乎无法正确地做到这一点,尽管我知道它应该很简单:{ - 我需要创建一个 LPWSTR 数组,然后用唯一的字符串填充它。我们的想法是做这样简单的事情: LPWSTR *wsz
这可能是一个非常愚蠢的问题,但这是我一直在努力解决的问题。在方法中更改 LPWSTR 后,它似乎只针对该特定方法进行更改,并在之后立即恢复。我知道全局变量是邪恶的,但这不是我的选择,因为它需要更改相当
Function CommandLineToArgvW 给了我 LPWSTR 类型的命令行参数。我需要 string 中的这些参数。有人能告诉我如何将 LPWSTR 转换为 string 吗? 我正在
我有一个 LPTSTR 类型的变量,我将其打印到 std::cout与 << 。在 ANSI 系统中(不知道它是在哪里确定的)它工作得很好,它打印了字符串。现在,在 Unicode 系统中,我得到的是
我是一名优秀的程序员,十分优秀!