Thread View: comp.sys.transputer
1 messages
1 total messages
Started by SPAHNI Stephane
Thu, 30 Aug 1990 13:27
gethostname()
Author: SPAHNI Stephane
Date: Thu, 30 Aug 1990 13:27
Date: Thu, 30 Aug 1990 13:27
24 lines
1241 bytes
1241 bytes
I have a problem with the "gethostname()" procedure from Meiko: it seems
to return nothing... I am using a MK200 board hosted in a Sun-3.
I tried the following program:
main()
{
char buffer[1000];
int code;
buffer[0] = '\0';
code = gethostname (buffer, sizeof buffer);
printf ("Host %s Code %d\n", buffer, code);
}
When run on a Sun, it returns the hostname of the machine. When run on a
transputer with mrun, it returns a code of 0 (no error), but the buffer is
left unchanged (if you don't initialize it, you don't get the '\0' !). In the
manual, it is written that it returns "the host machine being used to run the
server". It is correct to assume that it should be the hostname of the Sun ?
If not, how can I set the hostname ? (there is no "sethostname" procedure !).
Stephane Spahni
University of Geneva
spahni@cuisun.unige.ch
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads