I am trying to pass char array form c++(client) to python (server). I have made an interface using winsock I tested it by hello world string and it works. But in reality I need to pass floats from c++ side to python. (3 floats lets say x,y,z). These floats are constantly updated so the code I am talking about is in while loop and runs forever. In c++ I am processing real time data captured from IMU sensor and these needs to be further processed in Python. I tried to convert float values into char array:
char zarray[20];
sprintf(zarray, "%f", z_angle);// z_angle the float I need to pass
char *c[]={zarray};
Then send it to python:
iResult=send(sock,*c, (int)strlen(*c),0);
The output I am getting in python looks like this: 0.1152720.1152720.115272
I have no clue why is this happening and what kind of format is this. I tried to empty the char *c after:
iResult=send(sock,*c, (int)strlen(*c),0);
*c[0] = 0;
but it did not help. Does anyone know why is this happening?? Or are there any other ways I can pass floats from c++ to python using winsock??
Thank you