home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20338 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.1 KB  |  29 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!acd4!iedv6!dwj
  3. From: dwj@iedv6.acd.com ( Dan Johnson         )
  4. Subject: Re: Where does system("cd ./sudir") go ?
  5. Message-ID: <1993Jan28.223830.8725@acd4.acd.com>
  6. Sender: news@acd4.acd.com (USENET News System)
  7. Organization: Applied Computing Devices, Inc., Terre Haute IN
  8. References: <C1JMDn.9Gw@acsu.buffalo.edu>
  9. Date: Thu, 28 Jan 1993 22:38:30 GMT
  10. Lines: 17
  11.  
  12. In article <C1JMDn.9Gw@acsu.buffalo.edu> zshi@acsu.buffalo.edu (Zhixin Shi) writes:
  13. >I use
  14. >            system("cd ./sudir")
  15. >it looks like going into the subdir then come back when the program
  16. >finished.
  17.  
  18. I assume this is under UNIX.
  19.  
  20. The system() function forks a child process and the command executes
  21. in that process.  To change the current directory within a process,
  22. you need to use the chdir() system call (probably in section 2 of your
  23. manual).
  24. -- 
  25. Daniel W. Johnson                  Applied Computing Devices, Inc.
  26. Home: 71520.367@CompuServe.COM     Work: dwj@iedv1.acd.com
  27.       DanielJ13@aol.com                  39 25 02 N / 87 19 55 W
  28.                 - this space unintentionally left blank -
  29.