I use the NetBeans to program C++ , I want to get the current absolute path of the executable file
(~/NetBeansWorkSpace/project_1/dist/Debug/GNU-Linux-x86/executableFileName)
so I use
1, system("pwd")
2,getcwd(buffer,bufferSize)
then click the run button but they all get the wrong path: ~/NetBeansWorkSpace/project_1
Here is the surprise , I run the bash
cd ~/NetBeansWorkSpace/project_1/dist/Debug/GNU-Linux-x86/executableFileName
./executableFileName
I get the right path .
It's WHY ???