64,692
社区成员
发帖
与我相关
我的任务
分享
void OnData(const int dev_index, float qx, float qy, float qz, float qw, const int sr, const int bp) {
FILE *f;
printf("#%d -> %s, %.6f, %.6f, %.6f, %.6f\n", dev_index, scaned_devices[dev_index].address, qx, qy, qz, qw);
const int N = 1;
static char nad[N][256];
static float nqx[N];
static float nqy[N];
static float nqz[N];
static float nqw[N];
int i;
if (0 <= dev_index && dev_index<N) {
strncpy(nad[dev_index],scaned_devices[dev_index].address,255);nad[dev_index][255]=0;
nqx[dev_index] = qx;
nqy[dev_index] = qy;
nqz[dev_index] = qz;
nqw[dev_index] = qw;
f = fopen("d:\\mydata.txt", "w");
for (i = 0;i<N;i++) {
fprintf(f, "%d, %s, %.6f, %.6f, %.6f, %.6f\n", i, nad[i], nqx[i], nqy[i], nqz[i], nqw[i]);
}
fclose(f);
} else {
printf("#%d not in [0..%d]!\n", dev_index, N - 1);
}