gpt4 book ai didi

java - 将 Java 转换为 Symbian C/C++ - 字节和对象数组

转载 作者:太空宇宙 更新时间:2023-11-04 14:16:31 24 4
gpt4 key购买 nike

Java代码:

public static final byte cw_bArray = 0x01;
public static final byte cw_string = 0x02;

byte[] arr1=new byte[]{0x01};
byte[] arr2=new byte[]{0x02};
byte[] arr3=new byte[]{0x03};
byte[] code_ward_arr=new byte[]{cw_bArray,cw_string,cw_bArray};

method:
mount(null,new Object[]{arr1,arr2,arr3}, code_ward_arr);

我正在尝试将此代码转换为 symbian c/c++。我已经完成了这个,但我不知道如何通过争论任何人帮助我。

static const signed char cw_bArray = 0x01;
static const signed char cw_string = 0x02;

signed char a1 = {0x01};
signed char a2 = {0x02};
signed char a3 = {0x03};

signed char code_ward_arr[] = {cw_bArray,cw_bArray,cw_bArray};
//signed char bbb[] = {a1,a2,a3};
char *bb=new char[2];
bb[0] = a1;
bb[1] = a2;
bb[2] = a3;

mount(NULL, bb[] , code_ward_arr);

方法:

LOCAL_C void mount(signed char initData, char* obj[], signed char codeWord)
{

}

我正在尝试将这部分代码转换为 cjava代码:

Object obj[] = null;
if(codeWord==null){
obj = new Object[10];//Initial Loading Capacity
}else{
obj = new Object[codeWord.length];
}

C 代码:

char* obj[] = {NULL};

if(codeWord==NULL)
{
obj = new char[10];
}
else
{
obj = new char[Cwlen];
}

我会得到这个错误非法操作数 'char *[1]' = 'char *'

最佳答案

这应该可行

char a1[]={0x01};
char a2[]={0x01};
char a3[]={0x01};

char * bb [3];
bb[0] = a1;
bb[1] = a2;
bb[2] = a3;


mount(NULL, bb , code_ward_arr);

关于java - 将 Java 转换为 Symbian C/C++ - 字节和对象数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10713595/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com