home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12378 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  732 b 

  1. From: jbc@hpcuhe.cup.hp.com (Jeff Caldwell)
  2. Date: Sat, 15 Aug 1992 01:17:25 GMT
  3. Subject: Re: How can a program know where it was invoked?
  4. Message-ID: <31460026@hpcuhe.cup.hp.com>
  5. Organization: Hewlett Packard, Cupertino
  6. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscdc!hplextra!hpcc05!hpcuhb!hpcuhe!jbc
  7. Newsgroups: comp.lang.c
  8. References: <1992Aug9.024844.6230@debbie.cc.nctu.edu.tw>
  9. Lines: 14
  10.  
  11. > >      main(argc, argv)
  12. > >       int argc;
  13. > >       char     *argv[];
  14. > >      {
  15. > >         char string[20];
  16. > >         sprintf(&string, "which %s", argv[0]);
  17. > >         system(string);
  18. > >      }
  19. > Also, the & in front of "string" is wrong.
  20.  
  21. Oops.  Obvious typo.  Thanks for the correction.  
  22.  
  23.             -Jeff Caldwell
  24.