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
  • 97,681
  • 90
  • 411
  • 885
Hind Forsum
  • 9,717
  • 13
  • 63
  • 119

0 Answers0