我已经阅读了有关WideCharToMultiByte的文档,但我坚持这个参数:
lpMultiByteStr
[out] Pointer to a buffer that receives the converted string.
Run Code Online (Sandbox Code Playgroud)
我不太确定如何正确初始化变量并将其输入函数
可能重复:
将lptstr转换为char*
我需要转换LPTSTR p为CHAR ch[].我是C++的新手.
#include "stdafx.h"
#define _WIN32_IE 0x500
#include <shlobj.h>
#include <atlstr.h>
#include <iostream>
#include <Strsafe.h>
using namespace std;
int main(){
int a;
string res;
CString path;
char ch[MAX_PATH];
LPTSTR p = path.GetBuffer(MAX_PATH);
HRESULT hr = SHGetFolderPath(NULL,CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, p);
/* some operation with P and CH */
if(SUCCEEDED(hr))
{ /* succeeded */
cout << ch;
} /* succeeded */
else
{ /* failed */
cout << "error";
} /* failed */
cin >> …Run Code Online (Sandbox Code Playgroud) 我有一个以 PEM 格式存储在 Type 变量中的私钥字节LPSTR。IE
LPSTR pPrivateKeyInPem;
Run Code Online (Sandbox Code Playgroud)
现在我需要生成一个EVP_PKEYusing pPrivateKeyInPem,以便可以SSL_CTX使用SSL_CTX_use_PrivateKey()Openssl的API将其加载到一个对象中。
我怎样才能做到这一点?