At 05:42 PM 10/24/2004 -0000, bretedward writeth:
>I am building up a filename in a C program. I would like to
>include the host name (computer name) of the machine that the script
>runs on. The script will be run on many different (all same OS and
>version) machines, so the host name will change depending on which
>machine the script is executed on.
>
>There is a DOS command "hostname" that returns the host name to the
>screen.
>
>I have tried using it directly in my C program with no
>success. My program thinks that hostname is a variable and
>stops because it has not been declared. I have also tried using
>hostname as the argument for the system command -> system(hostname).
>This also does not work.
>
>I am able to use the DOS command, mkdir, directly in my program. I
>was hoping to be able to do the same with hostname.
>
>I would like to capture the host name in a string variable in my
>script.

Does the GetComputerName() or gethostname() APIs help any?  Both are useful
if all you need is the name for using it on a LAN.  Not always accurate,
but if you own all of the PCs they are quick-and-dirty hacks.  There are
more complex solutions, of course.


Thomas J. Hruska
[EMAIL PROTECTED]

Shining Light Productions
Home of the Nuclear Vision scripting language and ProtoNova web server.
http://www.slproweb.com/





To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=298184.5285298.6392945.3001176/D=groups/S=:HM/A=2319498/rand=853122462


Yahoo! Groups Links

Reply via email to