This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gcc 5.4.0 | |
#include <stdio.h> | |
int main(void) | |
{ | |
char str[100] = "MemFree: 3226700 kB"; | |
char s1[50]; | |
char s2[50]; | |
sscanf(str,"%s%*[ ]%s",s1,s2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gcc 5.4.0 | |
#include <stdio.h> | |
#include <string.h> | |
int main(void) | |
{ | |
char str[50]="Hello, world!\n"; | |
char *ptr; | |
ptr = strtok(str,","); | |
printf("%s",ptr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <netdb.h> | |
#include <arpa/inet.h> | |
int main(int argc, char *argv[]) | |
{ | |
struct hostent *lh = gethostbyname(argv[1]); | |
if (lh){ | |
printf("%s",inet_ntoa(*( struct in_addr*)lh->h_addr_list[0])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* For Windows */ | |
__declspec(align(32)) struct s | |
{ | |
char a; | |
int b; | |
}; | |
/* For Unix-like */ | |
alignas(32) struct s1 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <inttypes.h> | |
#include <sys/socket.h> | |
#include <netinet/ip.h> | |
#include <netinet/ip_icmp.h> | |
#include <arpa/inet.h> |