getcwd

sh: 0: getcwd() failed: No such file or directory on cited drive

馋奶兔 提交于 2020-11-30 02:12:25
问题 I am trying to compile ARM code in Ubuntu 12. Everything is working fine when I put the code in the local directory. But when I put the code in cited mount directory error shows up: making testXmlFiles sh: 0: getcwd() failed: No such file or directory ARM Compiling xxxxx.c sh: 0: getcwd() failed: No such file or directory Here is my setting in fstab //10.0.0.1/data /mnt/data cifs auto,noserverino,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=user,gid=users,noperm 0 0 What

sh: 0: getcwd() failed: No such file or directory on cited drive

对着背影说爱祢 提交于 2020-11-30 02:12:07
问题 I am trying to compile ARM code in Ubuntu 12. Everything is working fine when I put the code in the local directory. But when I put the code in cited mount directory error shows up: making testXmlFiles sh: 0: getcwd() failed: No such file or directory ARM Compiling xxxxx.c sh: 0: getcwd() failed: No such file or directory Here is my setting in fstab //10.0.0.1/data /mnt/data cifs auto,noserverino,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=user,gid=users,noperm 0 0 What

sh: 0: getcwd() failed: No such file or directory on cited drive

社会主义新天地 提交于 2020-11-30 02:12:05
问题 I am trying to compile ARM code in Ubuntu 12. Everything is working fine when I put the code in the local directory. But when I put the code in cited mount directory error shows up: making testXmlFiles sh: 0: getcwd() failed: No such file or directory ARM Compiling xxxxx.c sh: 0: getcwd() failed: No such file or directory Here is my setting in fstab //10.0.0.1/data /mnt/data cifs auto,noserverino,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=user,gid=users,noperm 0 0 What

Problems with getcwd syscall on OSX

坚强是说给别人听的谎言 提交于 2020-06-28 02:56:07
问题 Does anyone have an idea how to get the current working directory in OSX with NASM? The syscall getcwd isn't available on osx and dtruss pwd return lots of stat sys calls. However in the manual I can't find which structure variable of stat returns the current working directory. Thanks. 回答1: That's a bit late answer, but nonetheless this can be achieved using 2 syscalls. open_nocancel 0x2000018e (or open 0x2000005) opening a file descriptor for current dir fcntl_nocancel 0x20000196 (or fcntl

Why does getcwd() returns / in __destruct()?

帅比萌擦擦* 提交于 2020-01-02 05:11:26
问题 I have just noticed that getcwd() return "/" if called within __destruct() magic function, while in any other method it returns the expected path. Do you have an explanation for this? 回答1: It's a SAPI behaivor "Destructors called during the script shutdown have HTTP headers already sent. The working directory in the script shutdown phase can be different with some SAPIs (e.g. Apache)." From http://php.net/manual/en/language.oop5.decon.php But as mentioned in other answers there are plenty

get current working directory in Lua

时光毁灭记忆、已成空白 提交于 2019-12-30 05:47:12
问题 What's the Lua to get the current working directory on Windows XP SP3 (or to get the directory of the currently-running Lua file)? I prefer not to use LuaFileSystem. I can't use os.execute("cd") because os.execute always starts from my home directory (and thus always yields C:\Documents and Settings\username ). 回答1: Lua by default doesn't have a "native" way of supporting the concept of "current directory", or, in fact, the concept of "directory". The proper way to get the current directory

warning: comparison between pointer and integer in C

*爱你&永不变心* 提交于 2019-12-20 04:51:56
问题 I get a warning warning: comparison between pointer and integer on the line containing if from the next piece of code: char cwd[1024]; if (getcwd(cwd, sizeof(cwd)) != (char*)NULL) printf("%s\n",cwd); else error_print("error in pwd"); how and what do I need to fix? 回答1: Do you include unistd.h? If not, the error appears because your C compiler is assuming getcwd returns int. The fix? Include unistd.h 回答2: The prototype of getcwd is char *getcwd(char *buf, size_t size); Make sure you include

warning: comparison between pointer and integer in C

无人久伴 提交于 2019-12-20 04:51:14
问题 I get a warning warning: comparison between pointer and integer on the line containing if from the next piece of code: char cwd[1024]; if (getcwd(cwd, sizeof(cwd)) != (char*)NULL) printf("%s\n",cwd); else error_print("error in pwd"); how and what do I need to fix? 回答1: Do you include unistd.h? If not, the error appears because your C compiler is assuming getcwd returns int. The fix? Include unistd.h 回答2: The prototype of getcwd is char *getcwd(char *buf, size_t size); Make sure you include

How return a std::string from C's “getcwd” function

≡放荡痞女 提交于 2019-12-20 01:58:35
问题 Sorry to keep hammering on this, but I'm trying to learn :). Is this any good? And yes, I care about memory leaks. I can't find a decent way of preallocating the char*, because there simply seems to be no cross-platform way. const string getcwd() { char* a_cwd = getcwd(NULL,0); string s_cwd(a_cwd); free(a_cwd); return s_cwd; } UPDATE2: without Boost or Qt, the most common stuff can get long-winded (see accepted answer) 回答1: If you want to remain standard, getcwd isn't required to do anything

What is a cross-platform way to get the current directory?

元气小坏坏 提交于 2019-12-17 16:19:58
问题 I need a cross-platform way to get the current working directory (yes, getcwd does what I want). I thought this might do the trick: #ifdef _WIN32 #include <direct.h> #define getcwd _getcwd // stupid MSFT "deprecation" warning #elif #include <unistd.h> #endif #include <string> #include <iostream> using namespace std; int main() { string s_cwd(getcwd(NULL,0)); cout << "CWD is: " << s_cwd << endl; } I got this reading: _getcwd at MSDN getcwd at Kernel.org getcwd at Apple.com There should be no