Mailinglist Archive: opensuse (3104 mails)

< Previous Next >
Re: [SLE] programming question
  • From: gaf@xxxxxxxxxxxxxxxxxxx (Jerry Feldman)
  • Date: Sun, 02 Apr 2000 22:39:06 -0400
  • Message-id: <200004030239.WAA32033@xxxxxxxxxxxxxxxxxxx>



First, I think you might have a misunderstanding of the Linux (and Unix)
file system as well as C.
First, argv[0] contains the name of the file as it was typed. If /usr/bin
is in your path, and your program is /usr/bin/fubar argv[0] will contain
fubar if you typed fubar.

Also, remember that in Linux, files do not reside in directories. The
directory entry is just a pointer to the inode. An old Unix technique is to
create hard links to a single file. For instance, /bin/vi, /bin/view,
/bin/ex would all be hard links to the same file. So if you types the view
command, you would access the file in view (read only) mode.
jason wrote:
> ok i'm desperate and kan't find an answer.
>
> Does anyone know how 2 get the directory of the programming currently running
> .
> ie, fubar (the app) is stored in /usr/bin
> i do:
> cd /
> fubar
>
> output should be "/usr/bin"
>
> how would i do this. I've tried everything i can think of and everything in
> my
> books and i still can't get it to work. btw it's in c
>
> --
> To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
> For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
>
> Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
>


--
Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix user group
http://www.blu.org

--
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/


< Previous Next >
References