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@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
--
Jerry Feldman