pwd - C equivalent

J

Jens Thoms Toerring

MN said:
Is there any C function that returns the current working directory ?

If you mean with "C function" a function defined by the C standard
then the answer is no since C doesn't require that the system has
any concept of a "working directory". But, of course, there are
system specific functions for that purpose. If yot are using e.g.
a POSIX compliant system you could use getcwd().

Regards, Jens
 
G

Guest

Is there any C function that returns the current working directory ?

no, there is no function to do this in the standard library.
This is platform specific so you need to ask on a platform
specific newsgroup (Unix in your case)
 
U

user923005

Is there any C function that returns the current working directory ?

If you don't mind switching to C++, ACE will give you current working
directory for the following:

aix-5.x
all
cray
cygwin32
doxygen
freebsd
hpux-11.00
integritySCA
irix6.x
linux
lite
lynxos
macosx-panther
macosx-tiger
macosx
macros
minimal
mvs
netbsd
openbsd
openvms
pharlap
posix-nonetworking
posix
qnx-neutrino
qnx-rtp-62x
qnx-rtp-pre62x
qnx-rtp
rtems
sco-5.0.0-nothread
sco-5.0.0
sunos5.10
sunos5.4-g++
sunos5.4-sunc++-4.x
sunos5.5
sunos5.6
sunos5.7
sunos5.8
sunos5.9
tandem-nsk-mips-v2
tandem-nsk-mips-v3
tandem
tru64
unixware-2.01-g++
unixware-2.1.2-g++
unixware-7.1.0
unixware-7.1.0.udk
visualage
vxworks5.x
vxworks6.2
vxworks6.3
vxworks6.4
vxworks6.5
win32
WinCE

Of course, for some platforms (e.g. your toaster's IC) current working
directory is hard to put your finger on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top