Hostname: Difference between revisions

m
Switch to header template
m (→‎[[Java]]: Use Java header instead)
m (Switch to header template)
Line 3:
Find the name of the host on which the routine is running.
 
==[[{{header|C]]}}==
[[Category:C]]
'''Compiler:''' [[GCC]] 4.0.1
 
Line 18 ⟶ 17:
}
 
==[[{{header|C sharp|C#]]}}==
[[Category:C_sharp]]
System.Net.Dns.GetHostName();
 
==[[{{header|IDL]]}}==
[[Category:IDL]]
 
hostname = GETENV('computername')
 
Line 31 ⟶ 27:
String hostname = java.net.InetAddress.getLocalHost().getHostName();
 
==[[{{header|Perl]]}}==
[[Category:Perl]]
'''Interpreter:''' [[perl]] 5.8.6
use Sys::Hostname;
Line 38 ⟶ 33:
$name = hostname;
 
==[[{{header|Pop11]]}}==
[[Category:Pop11]]
 
lvars host = sys_host_name();
 
==[[{{header|Python]]}}==
[[Category:Python]]
'''Interpreter:''' [[Python]] 2.5
 
Line 50 ⟶ 42:
host = socket.gethostname()
 
==[[{{header|Tcl]]}}==
[[Category:Tcl]]
 
The basic introspection tool in TCL is the <tt>info</tt> command. It can be used to find out about the version of the current Tcl or Tk, the available commands and libraries, variables, functions, the level of recursive interpreter invocation, and, amongst a myriad other things, the name of the current machine:
 
set hname [info hostname]
 
==[[{{header|Toka]]}}==
[[Category:Toka]]
 
2 import gethostname
1024 chars is-array foo