我在通过套接字发送整数数组时遇到了麻烦。代码看起来像这样
程序1:(在windows上运行)
int bmp_info_buff[3];
/* connecting and others */
/* Send informations about bitmap */
send(my_socket, (char*)bmp_info_buff, 3, 0);
程序 2:(在中微子上运行)
/*buff to store bitmap information size, with, length */
int bmp_info_buff[3];
/* stuff */
/* Read informations about bitmap */
recv(my_connection, bmp_info_buff, 3, NULL);
printf("Size of bitmap: %d\nwidth: %d\nheight: %d\n", bmp_info_buff[0], bmp_info_buff[1], bmp_info_buff[2]);
它应该打印位图大小:64
宽度:8
高度:8
位图大小:64
宽度:6
高度:4096
我做错了什么?