getcwd is returning NULL

359 views
Skip to first unread message

Romil Mittal

unread,
Mar 27, 2009, 7:00:27 AM3/27/09
to andro...@googlegroups.com

Hi,

 

Calling ‘getcwd(char *, int)’ from a shared library is returning NULL. The shared library is getting loaded from an Android app started from Launcher.

 

Is this expected?  If not, what should be the correct return value?

 

Thanks.

-romil

fadden

unread,
Mar 27, 2009, 4:32:18 PM3/27/09
to android-ndk
On Mar 27, 4:00 am, Romil Mittal <ro...@adobe.com> wrote:
> Calling 'getcwd(char *, int)' from a shared library is returning NULL. The shared library is getting loaded from an Android app started from Launcher.
>
> Is this expected?  If not, what should be the correct return value?

What value are you using for the second argument?

What is errno set to when the function returns?

Divij Kumar

unread,
Apr 2, 2009, 4:25:06 AM4/2/09
to andro...@googlegroups.com
I tried it in a native program and am able to get the correct working directory. Something like the following works for me.

getcwd(buf, 1024);

where buf has already been malloced.
Reply all
Reply to author
Forward
0 new messages