Hostname: Difference between revisions

(added objective c)
Line 6:
Works with GCC/GNAT
<pre>
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Sockets;
....
 
Name : constant string := GNAT.Sockets.Host_Name);
procedure Demo is
--------
begin
with GNAT.Sockets
Name : constant string :=Put_Line (GNAT.Sockets.Host_Name);
with Ada.Strings.Unbounded;use Ada.Strings.Unbounded;
end Demo;
...
Name : Unbounded_String;
...
Name := TO_Unbounded(GNAT.Sockets.Host_Name);
---------
with GNAT.Sockets
...
Name : Access String;
...
Name := new String'(GNAT.Sockets.Host_Name);
</pre>
 
Anonymous user