Hostname: Difference between revisions

Content added Content deleted
(-> IDL)
(added C, Perl)
Line 2: Line 2:


Find the name of the host on which the routine is running.
Find the name of the host on which the routine is running.

==[[C]]==
[[Category:C]]
'''Compiler:''' [[GCC]] 4.0.1

'''Standard:''' [[POSIX.1]]

#include <limits.h>
#include <unistd.h>
int main()
{
char name[_POSIX_HOST_NAME_MAX+1];
gethostname(name, _POSIX_HOST_NAME_MAX+1);
}


==[[IDL]]==
==[[IDL]]==
Line 7: Line 22:


hostname = GETENV('computername')
hostname = GETENV('computername')

==[[Perl]]==
[[Category:Perl]]
'''Interpreter:''' [[perl]] 5.8.6
use Sys::Hostname;
$name = hostname;


==[[Tcl]]==
==[[Tcl]]==