0

I am creating a file inside a c file:

open("my.txt"...);

Compile this program as /user/abc/linux/c/program01. Then if I am in directory /user/abc and try to type

'linux/c/program01'

I found that the file name "my.txt" is created under current directory of /user/abc/my.txt. But I wish to file is created under the directory where the binary program01 is put.

So my question is: how does a program know which directory itself is sitting in?

Thanks a lot.

jww
  • 90,984
  • 81
  • 374
  • 818
Hind Forsum
  • 8,897
  • 9
  • 50
  • 103

0 Answers0