Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Host-introspection/C/host-introspection-1.c
Normal file
22
Task/Host-introspection/C/host-introspection-1.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include <stdio.h>
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include <limits.h> /* for CHAR_BIT */
|
||||
|
||||
int main() {
|
||||
int one = 1;
|
||||
|
||||
/*
|
||||
* Best bet: size_t typically is exactly one word.
|
||||
*/
|
||||
printf("word size = %d bits\n", (int)(CHAR_BIT * sizeof(size_t)));
|
||||
|
||||
/*
|
||||
* Check if the least significant bit is located
|
||||
* in the lowest-address byte.
|
||||
*/
|
||||
if (*(char *)&one)
|
||||
printf("little endian\n");
|
||||
else
|
||||
printf("big endian\n");
|
||||
return 0;
|
||||
}
|
||||
10
Task/Host-introspection/C/host-introspection-2.c
Normal file
10
Task/Host-introspection/C/host-introspection-2.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
if (htonl(1) == 1)
|
||||
printf("big endian\n");
|
||||
else
|
||||
printf("little endian\n");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue