如何在VxWorks shell中定义数组?
例如,如果我想要以下内容:
myArray[3] = {1,2,3};
答案 0 :(得分:3)
我不确定你能不能直接。您可以使用例如malloc分配一些内存,然后根据您想要的值设置内存 - 类似下面的内容
//Allocate the array
-> myArray = malloc( 3 )
// use the m Command to edit the memory
-> m &myArray
// do this for each element you want to set
-> 0x12ff3120 1
-> 0x12ff3121 2
// Check the memory
d &myArray
-> 0x12ff3120: 0001 0002 0003 0000
这可以假设您需要一个char大小的元素数组。对于其他尺寸,修改m命令以编辑例如字大小的块:
->m &myArray 4