Hello,
I am trying to send a list as input from python to c. But I am struggling to do that:
1)I do not know how to send list as an input
2)I also do not know how to receive this input in c:
Here is my python code:
I am trying to send a list as input from python to c. But I am struggling to do that:
1)I do not know how to send list as an input
2)I also do not know how to receive this input in c:
Here is my python code:
Code:
combinations = list(itertools.product([0, 1], repeat=(6)))
for xz in combinations:
angle_ = angle_*math.pi/180
print("Angle_: ", angle_)
angle=angle_
x = subprocess.run(["./sim", str(angle_), int(xz),int(xz)], stdout=subprocess.PIPE)
#this line is wrong. I am telling int(xz) but it is list
print("Angle: ", angle)
And here is the main.c:
int main(int argc,char *argv[]){
//int i_xset,i_zset;
int xset[6],zset[6];
sscanf(argv[1], "%le",&angle);
sscanf(argv[2], "%i",&i_xset);
sscanf(argv[3], "%i", &i_zset);