0

I have create a project in which I am trying to generate a .txt file and then calling OS specific commands (I'm using unix so using system() function to trigger application) to open it in default application.

My code works perfect.

But the problem starts when I try to run my application after setting it in environment path. I am doing that for global visibility. File gets generated correctly by while opening the .txt using system() seems like it is trying to look at it at different directory.

I want to some how convey to the system() function to look at the specific location.

How can I solve this problem?

kishoredbn
  • 2,007
  • 4
  • 28
  • 47

1 Answers1

0

It sounds like you are actually just in a different working directory. Try showing the result of getcwd.

sehe
  • 374,641
  • 47
  • 450
  • 633
  • this is actually very close to what I want. i'm getting the entire path of my current address. but what I'm looking for is path where program is stored. Not the path from where I'm executing the program. – kishoredbn Oct 29 '15 at 01:07