home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!gatech!concert!mercury!newton
- From: newton@mercury.ncat.edu (Cynthia D. Newton)
- Subject: gethostnamae(), novice question...
- Message-ID: <1992Jul25.070709.7498@mercury.ncat.edu>
- Organization: North Carolina A&T State University
- Date: Sat, 25 Jul 1992 07:07:09 GMT
- Lines: 20
-
-
- #include <stdio.h>
-
- main() {
- char *host[64];
- gethostname(host, sizeof host);
- printf("%s\n",host);
- }
-
- Hi:
-
- This program gets the hostname as 'mercury.ncat.edu'. What's the decent
- way/s to strip off the .ncat.edu part? I know how to do that by sed. The
- solution should be general, I mean should be applicable to any hostname with
- domain name in it.
-
- Thanks.
-
- --
- C Newton
-