主题
Base64解码 - Base64Decode
函数简介
对Base64编码的字符串进行解码。
接口名称
Base64DecodeDLL调用
c
long Base64Decode(long instance, string source);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| source | 字符串 | Base64编码的字符串。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
string decoded = ola.Base64Decode("aGVsbG8gb2xh");csharp
using OLAPlug;
var ola = new OLAPlugServer();
string decoded = ola.Base64Decode("aGVsbG8gb2xh");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
decoded = ola.Base64Decode("aGVsbG8gb2xh")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
String decoded = ola.Base64Decode("aGVsbG8gb2xh");cpp
var ola = com("OlaPlug.OlaSoft")
var decoded = ola.Base64Decode("aGVsbG8gb2xh")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
decoded = ola.Base64Decode("aGVsbG8gb2xh")text
.局部变量 ola, OLAPlug
ola.创建 ()
decoded = ola.Base64Decode("aGVsbG8gb2xh")aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var decoded = ola.Base64Decode("aGVsbG8gb2xh");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
文本型 decoded = ola.Base64Decode("aGVsbG8gb2xh")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
std::string decoded = ola.Base64Decode("aGVsbG8gb2xh");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long ptr = Base64Decode(instance, "aGVsbG8gb2xh");
if (ptr != 0) {
char buffer[4096] = {0};
GetStringFromPtr(ptr, buffer, sizeof(buffer));
FreeStringPtr(ptr);
}csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long Base64Decode(long ola, string source);
long instance = CreateCOLAPlugInterFace();
long ptr = Base64Decode(instance, "aGVsbG8gb2xh");
if (ptr != 0) {
StringBuilder sb = new StringBuilder(GetStringSize(ptr) + 1);
GetStringFromPtr(ptr, sb, sb.Capacity);
FreeStringPtr(ptr);
string decoded = sb.ToString();
}python
from ctypes import CDLL, c_int, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ptr = ola.Base64Decode(instance, b"aGVsbG8gb2xh")返回值
| 返回值 | 说明 |
|---|---|
非 0 | 成功,返回 解码后的原始数据的字符串指针。 |
0 | 失败。 |
