How a program can know where it is located by itself?


 
Thread Tools Search this Thread
Top Forums Programming How a program can know where it is located by itself?
# 1  
Old 12-15-2004
Question How a program can know where it is located by itself?

Hello, I'm a begginer of programming in UNIX platform.

Now I'm trying to make a C program on Hp-UX11i
and the program needs to know its absolute path
when it is executed.

the current directory of the program is not enough,
because the program may change the current directory...
I need to know where it is located.

If you know how to get such information or good tutorial site,
please tell me.

regards.
# 2  
Old 12-15-2004
There is no great solution, but see this... How can an executing program determine its own pathname?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

The DNS files, where are located?

Hello, please where are located DNS files on various linux distributions? Mainly im interested in CentOS (RedHat) and Ubuntu (Debian). I mean i will be changing IPs and i have registered nameservers on my domain registar and it points to OLD IP, so i need to know in which files to edit on... (3 Replies)
Discussion started by: postcd
3 Replies

2. IP Networking

Pinging IP located on another interface

Hi, I have a rather strange IP question... Here's my problem: I have a Linux box (call it "turing") with 2 NICs. One network interface (eth0) has an IP assigned, say 192.168.42.50. The other interface (eth1) is up, but has no IP yet. My question: is it possible to determine from... (3 Replies)
Discussion started by: NH2
3 Replies

3. UNIX for Dummies Questions & Answers

sudo dmidecode where is the file located ?

Been through all my /sys /sbin /bin directories and can't seem to find it. (2 Replies)
Discussion started by: jcnewton13
2 Replies

4. Programming

Where are the library function definitions located?

Hi friends, I hope everyone is doing fine. I have this confusion, hope you can help me out with it. The header files contain only function prototypes. Where are the function definitions located. For example, if I would like to see how printf works, where can I see its definition, stdio.h only... (2 Replies)
Discussion started by: gabam
2 Replies

5. Hardware

Where is the BIOS located???

Hi friends, I hope you are doing well. Can you please tell me which part of the motherboard contains the BIOS software, name that exact location. And could please give me the names of the firmwares for atleast 5 archetictures, like sun sparc, ibm power, hp alpha etc. Looking forward to your... (0 Replies)
Discussion started by: gabam
0 Replies

6. Shell Programming and Scripting

How do I go about finding a value located in one file in another?

Hi, I have to determine which VALID users made a failed loggon attempts on our server.To make a long story short, I have isolated the list of all the usernames and number of attempts in one file, and have isolated the valid users who have made failed loggon attempts in another file. I now have... (2 Replies)
Discussion started by: mojoman
2 Replies

7. UNIX for Dummies Questions & Answers

how to know the device on which the file is located

Hi, i want to know on which device a file is located is there any command or anyway to know it thanks santosh (5 Replies)
Discussion started by: santosh149
5 Replies

8. Shell Programming and Scripting

Deleting a file located on another server

Hi, I have successfully copied a file from one server to another using following command. user1@server1# scp test.jsp user2@server2:/home/ Now i want to delete that copied file(test.jsp) from "server2" by running some command from server1. Please help... (2 Replies)
Discussion started by: SanketJOSHI
2 Replies

9. Solaris

where is the installation script located?

Hi all, I have an intriguing question.... Consider these options..(obtained the first installations of solaris) 1.solaris installation -console mode 2.single user login 3.update drivers I wanted to know which script handles this and where it is located? Does anyone know the absolute... (0 Replies)
Discussion started by: wrapster
0 Replies

10. UNIX for Dummies Questions & Answers

Where is the master boot record located?

From doing some research it should be /dev/sda (SCSI drive) but mine doesn't display that. How can I find out where it is located? (1 Reply)
Discussion started by: shorty
1 Replies
Login or Register to Ask a Question