Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <stdio.h>
#include <unistd.h>
int main(void) {
char host[256];
if (gethostname(host, sizeof(host)) == 0)
host[sizeof(host) - 1] = '\0';
printf("%s\n", host);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.