Results 1 to 2 of 2
I am writing a programme in C. It resides in the ~/Projects/ProjectName/src directory. There is a subdirectory in ProjectName called Formulas. One of the source files of my programme queries ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-16-2005 #1
- Join Date
- Jul 2004
Question about C
But this only works when I call the executable from the src subdirectory. I does not work when the executable is called from any other directory.
What is the best method for solving the problem, other than to provide the full path name? I would like a solution that would make the programme transferrable to other computers as well.
Thanks in advance for your help.
- 12-16-2005 #2
There are a number of solutions. The reason it's failing is because the 'cat' command has been given a relative pathname to the file to read. Try using the absolute path, and it'll work great. Even better, you can have the path specified by environment variable or even in a config file somewhere to get it right across different machines.Linux user #126863 - see http://linuxcounter.net/