python - 如何使用 ctypes 接收 wchar_t * 字符串
问题描述
使用 ctypes 的类 Python 代码
我正在用python编写代码来使用一个dll。此 dll 请求以这种格式生成的密钥。我怎么能用python做到这一点?
C++
string Code = "1234567890987654321";
const wchar_t* key;
wstring keystr = std::wstring(Code.begin(), Code.end());
key = keystr.c_str();
我试过这样的Python
Code = "1234567890987654321"
keystr = c_wchar_p(Code)
key = c.create_unicode_buffer(keystr)
解决方案
推荐阅读
- amazon-web-services - Asp.Net Core 2.2 进程内托管超时 IIS
- java - 如何实例化远程 Web 驱动程序,以便我可以使用带有 Serenity 的 Java 和 Selenium 并行运行测试
- laravel - Laravel 添加自定义属性到分页结果
- javascript - 在 JavaScript 中将数字转换为二进制代码?
- python - 通过 XML 解析时正在删除记录
- c - 在递归函数中使用 readdir 时出现分段错误
- amazon-ec2 - Kube8s pod 无法连接到调度程序
- asp.net-core - 基于 IIS 的网站无法连接到远程服务器
- visual-studio - 如何在 Winforms App Center 版本中包含 SQLite 数据库?
- go - 从 Go 使用 SIUSBXP 的正确方法是什么?