Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Print hostname
/* * Prints hostname and domain name. */ #include <unistd.h> #include <stdio.h> #define LENGTH 257 //hostname length. int main( void ) { int ret; //return code char hn[ LENGTH ]; ret = gethostname( hn, LENGTH ); if( ret ) //if `ret' is nonzero, { perror("gethostname"); return ret; } printf("Hostname: %s\n", hn ); char dn[ LENGTH ]; ret = getdomainname( dn, LENGTH ); if( ret ) { perror("getdomainname"); return ret; } printf("Domain Name: %s\n", dn ); }
run
|
edit
|
history
|
help
1
with goto, with j++
Project 3 part 2 Book v1.1
C_141210_Funciones
2.1 Comparision of Matrix Transpose Execution Time
1
b=1,c=1
Divisibility :- #simple-math #ad-hoc-1 #basics
Prime no
A_141121_mayorMenor
Búsqueda binaria rec