Anonymous user
Hostname: Difference between revisions
→{{header|C}}/{{header|C++}}
m (→{{header|Icon}} and {{header|Unicon}}: -workswith) |
|||
Line 39:
{{works with|POSIX|.1}}
<lang c>#include <
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
int main(void)
{
return gethostname(name, sizeof name) == -1 || printf("Hostname: %s\n", name) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}</lang>
|