Created
July 6, 2016 05:17
-
-
Save djgoku/06a14d31c3646f2309f1d16c9b018b86 to your computer and use it in GitHub Desktop.
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
use v6; | |
use NativeCall; | |
# int inet_pton(int af, const char * restrict src, void * restrict dst); | |
sub inet_pton(int32, Str, uint32 is rw) returns int32 is native(Str) { * } | |
# const char *inet_ntop(int af, const void * restrict src, char * restrict dst, socklen_t size); | |
sub inet_ntop(int32, uint32, Str is rw, uint8) returns Str is native(Str) { * } | |
my uint32 $s_addr; | |
my Str $ip; | |
inet_pton(2, "192.168.2.33", $s_addr); | |
say $s_addr; | |
say inet_ntop(2, $s_addr, $ip, 16); | |
say $ip; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment