Questions tagged [getcwd]

The getcwd() function retrieves the current working directory pathname on POSIX compliant machines.

The function getcwd() is available on Unix machines to copy the current working directory (as an absolute pathname) to a supplied buffer of an array of characters of a given length. It is specified in POSIX.1-2001 to have the following signature:

char *getcwd(char *buffer, size_t size);
104 questions
0
votes
0 answers

How does the OS module in python access system functions in linux?

newbie to python and linux here. I dont understand how the OS module in python can access system specific functions for example the getcwd() method which returns the current directory of the system, in linux this would be equivalent of typing in…
0
votes
1 answer

python's os.getcwd() randomly stops working

I run a python 2.7 program with tensorflow on my ubuntu 16.04 machine. At some point (it randomly changes when that happens), the program crashes because os.getcwdu() fails. I then run python in the same terminal session, try to run import os…
0
votes
1 answer

Is it possible to get Current Working Directory in miniperl (NOT PERL)?

The only difference between miniperl and perl is that miniperl cannot load XS-based perl modules as shared objects. So it can't load WIN32 or CWD modules. Is it possible to get Current Working Directory in miniperl?
NoSkill
  • 718
  • 5
  • 15
0
votes
1 answer

Why does system() complain that cwd is not known?

I am using system() to run some Unix commands from my application with code like the following: std::stringstream command; command << "rm -rf /some/directory"; int rmResult = system(command.str().c_str()); if (rmResult != 0) { clog << "Error:…
WilliamKF
  • 41,123
  • 68
  • 193
  • 295
0
votes
1 answer

Print getcwd path

My instructions are pretty clear, but I'm doing it wrong, can you help correct my error? Instructions: else if (“pwd”) declare a char variable array of size MAX_PATH_LENGTH to hold the path do a getcwd print the path my code: }else…
TeSa
  • 37
  • 1
  • 8
0
votes
2 answers

python3, directory is not correct when import a module in sub-folder

I have a main folder called 'test', the inner structure is: # folders and files in the main folder 'test' Desktop\test\use_try.py Desktop\test\cond\__init__.py # empty file. Desktop\test\cond\tryme.py Desktop\test\db\ Now in the file tryme.py. I…
aura
  • 383
  • 7
  • 24
0
votes
1 answer

Perl - get abs path to module from other directory in main script

I created a simple perl script which is splited into 2 files - main.pl and content.pm The main script is placed in Project directory and content.pm (module) is placed in Project/utils directory. Now I want to use content.pm in main.pl I made…
Developus
  • 1,400
  • 2
  • 14
  • 50
0
votes
1 answer

Placing function in .dll causes debug assertion failed error

Hallo fellow members, I run into a very strange problem today and I am not exactly sure as to what is causing it. Here is a function which I use to get the current working directory : #ifdef _WIN32 #include #define GetCurrentDir…
0
votes
1 answer

How can I use process.cwd() within Angular2 Component with TypeScript?

How can I use process.cwd() within Angular2 Component with TypeScript? What do I have to import? The following in the constructor console.log("Where I am: ", process.cwd()); outputs the error: ORIGINAL EXCEPTION: ReferenceError: process is not…
user2227400
0
votes
1 answer

Consistently Getting Null Value in C String using getcwd

I am trying to make a simple program that just writes your working directory to a file, and I cannot, for the life of me, figure out what I am doing wrong. No matter what I do, my buffer is storing null after my call to getcwd(). I suspect it may…
Ronald
  • 11
  • 3
0
votes
1 answer

Get the original location where the program is called

Is there any way to know the directory where the program is originally spawned in C? I want my program to know where it is located in the computer. I already tried using _getcwd() in direct.h. I also tried getcwd() using unistd.h. But here's the…
Bryan James
  • 65
  • 1
  • 11
0
votes
1 answer

_fullpath Giving Hex Value in Visual Studio C++

I'm trying to find out what my crrent working directory is. I've tried using both _fullpath and _getcwd as part of . However, all it gives me is an 8-byte hex value (such as 5504CA90). Why is it giving me this, and how can I get the…
0
votes
0 answers

How to format filepath with spaces in Mac OSX C++

I am trying to use the stat() function in a C++ program I'm writing for Mac OS X. the stat() function fails to find this directory: /Users/devuser/git/thisprogram/build/Release/ABC USER Testing App.app/Contents/Resources But it is able to find this…
gonzobrains
  • 7,856
  • 14
  • 81
  • 132
0
votes
0 answers

iOS getcwd alternative

I am porting my C++ OpenGL application to iOS, it uses getcwd function to load shaders. In iOS 'getcwd' returns just a slash and I can't do something. Or is there any good method to load files on iOS? Edit: found a solution! POSIX-based code.…
neko_code
  • 569
  • 11
  • 21
0
votes
3 answers

Performance of GNU C implementation of getcwd()

According to the GNU Lib C documentation on getcwd()... The GNU C Library version of this function also permits you to specify a null pointer for the buffer argument. Then getcwd allocates a buffer automatically, as with malloc(see Unconstrained…
JasonM
  • 21
  • 1