不知道为什么我得到一个 24 相对于 40 的 strlen?谢谢
char bufferData[1000];
memset(bufferData, '\0', 1000);
long j;
long offset;
double mice;
mice = 32.45;
j=0;
offset = sizeof(double) * j;
NSLog(@"offset: %d", offset);
memcpy(bufferData+offset, &mice, sizeof(double));
mice = 21.35;
j=1;
offset = sizeof(double) * j;
NSLog(@"offset: %d", offset);
memcpy(bufferData+offset, &mice, sizeof(double));
mice = 11.55;
j=2;
offset = sizeof(double) * j;
NSLog(@"offset: %d", offset);
memcpy(bufferData+offset, &mice, sizeof(double));
mice = 41.25;
j=3;
offset = sizeof(double) * j;
NSLog(@"offset: %d", offset);
memcpy(bufferData+offset, &mice, sizeof(double));
mice = 51.50;
j=4;
offset = sizeof(double) * j;
NSLog(@"offset: %d", offset);
memcpy(bufferData+offset, &mice, sizeof(double));
NSLog(@"sizeof(double): %d strlen(bufferData): %d", sizeof(double), strlen(bufferData));
}