Skip to content

Instantly share code, notes, and snippets.

@omerk
Created March 14, 2013 14:52
Show Gist options
  • Save omerk/5161962 to your computer and use it in GitHub Desktop.
Save omerk/5161962 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int
main (void)
{
FILE *f;
char name[255];
if( !(f = popen("uname -n", "r")) ){
perror("Can't execute cmd");
}
fgets(name, 255, f);
printf("Node name: %s", name);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment