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
Maze
poist
CO Assignment 1 Question 4
Finite State Machine Program Example (ECE 2534)
Even odd program
Program to calculate characters
Print Micro Seconds
app1
dynamic memory allocation.c
BSEARCH() WITH STRUCT