Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:\Codes>more ip_address_test.c
- #include <stdio.h>
- int main(void)
- {
- unsigned char a,b,c,d;
- scanf("%hhu.%hhu.%hhu.%hhu", &a,&b,&c,&d);
- printf("%hhu\t%hhu\t%hhu\t%hhu\t", a, b, c, d);
- return 0;
- }
- // https://stackoverflow.com/questions/19558013/ip-address-input-in-c
- C:\Codes>
- C:\Codes>gcc -Wall ip_address_test.c -o ip_address_test
- ip_address_test.c: In function 'main':
- ip_address_test.c:6:13: warning: unknown conversion type character 'h' in format [-Wformat=]
- scanf("%hhu.%hhu.%hhu.%hhu", &a,&b,&c,&d);
- ^
- ip_address_test.c:6:13: warning: unknown conversion type character 'h' in format [-Wformat=]
- ip_address_test.c:6:13: warning: unknown conversion type character 'h' in format [-Wformat=]
- ip_address_test.c:6:13: warning: unknown conversion type character 'h' in format [-Wformat=]
- ip_address_test.c:6:13: warning: too many arguments for format [-Wformat-extra-args]
- ip_address_test.c:7:14: warning: unknown conversion type character 'h' in format [-Wformat=]
- printf("%hhu\t%hhu\t%hhu\t%hhu\t", a, b, c, d);
- ^
- ip_address_test.c:7:14: warning: unknown conversion type character 'h' in format [-Wformat=]
- ip_address_test.c:7:14: warning: unknown conversion type character 'h' in format [-Wformat=]
- ip_address_test.c:7:14: warning: unknown conversion type character 'h' in format [-Wformat=]
- ip_address_test.c:7:14: warning: too many arguments for format [-Wformat-extra-args]
- C:\Codes>
- C:\Codes>dir ip_address_test.*
- Directory of C:\Codes
- 03/11/2018 09:34 PM 257 ip_address_test.c
- 03/11/2018 09:34 PM 30,513 ip_address_test.exe
- 2 File(s) 30,770 bytes
- C:\Codes>
- C:\Codes>ip_address_test.exe
- 8.8.8.8
- 0 0 0 8
- C:\Codes>
- C:\Codes>ip_address_test.exe
- 192.168.1.1
- 0 0 0 1
- C:\Codes>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement