We found in Linux , the storage of integer is little-endian.
Test
void printchar(char * p , int length ){
for (int i = 0;i<length;i++){
printf("%x ",p[i]);
}
}
int main() {
int x= 0x12345678;
char * p =(char *)(&x);
printchar(p,4);
printf("\nAfter hton funciton , this is show like this :\n");
int y = htonl(x);
char * py =(char *)(&y);
printchar(py,4);
}
Then we will find the output is showed like this :
78 56 34 12
After hton function , this is show like this :
12 34 56 78
One more thing ,my test environment is :4.8.0-39-generic, thanks for your reading.