• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting current working directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting current working directory


  • Subject: Getting current working directory
  • From: Tony Scaminaci <email@hidden>
  • Date: Sun, 28 Jan 2007 12:35:20 -0600

Hi,

I'm trying to programatically get and save the current working directory using a low-level system call. They key points are that I need to store the path string for later use and whatever system call I use must be available in single-user mode. Using a call like system ("/bin/pwd") displays the path to stdout but I can't figure out how to redirect the string to a character array for later concatenation. Since the string already exists in the PWD env variable, is there some way to read that in a C program? I'm not sure the latter is the best way though since the user's shell may be different than bash. I've been searching the online docs for hours and haven't found a way to do this yet.

Thanks,

Tony
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Getting current working directory
      • From: Nat Lanza <email@hidden>
  • Prev by Date: Re: crash
  • Next by Date: Re: Getting current working directory
  • Previous by thread: Re: crash
  • Next by thread: Re: Getting current working directory
  • Index(es):
    • Date
    • Thread