LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-10-2006, 10:24 AM   #1
erwinfletch
LQ Newbie
 
Registered: Jan 2006
Posts: 17

Rep: Reputation: 0
what is the call to determine the app you are running in


Hi-

I need the cpp call that will tell me the full path to the app I'm running in. For example, I'm running in a loaded library for either mozilla or firefox, but would like to know the full path to the executable

/usr/bin/firefox
/usr/bin/mozilla
/usr/local/firefox1_5

etc...

(For windows programmers, it would be the Linux version of GetModuleFileNameW)

Thanks!
 
Old 01-10-2006, 10:31 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
same as C isn't it?
main(int argc, char** argv)

argc is no of args

argv[0] is the pathname.
argv[1] is arg 1 ... etc
 
Old 01-10-2006, 10:46 AM   #3
erwinfletch
LQ Newbie
 
Registered: Jan 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Hi- Thanks for the reply...

That would be true if I had a main... unfortunately I don't since I'm running in a .so. I'm looking for a function call that will give me the same information. I've now found the Mac version for the call(GetFilePathFromFSRef) but still no linux. I'm assuming it will be the same for all UNIX flavors, but maybe not.

Thanks!
 
Old 01-11-2006, 09:52 AM   #4
ask.jackal
LQ Newbie
 
Registered: Jan 2006
Location: India
Distribution: Suse
Posts: 12

Rep: Reputation: 0
probably use getuid() and read the info from /proc/$PID/cmdline and /proc/$PID/environ.Assumes a proc file system for u.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I determine what version of Linux is running? DStrick64 Linux - Newbie 17 05-30-2012 09:29 AM
Check if an app is running and if it's not launch this app Coume Linux - General 3 07-28-2008 02:34 AM
how to determine if a program is running? iclinux Programming 10 02-04-2005 03:12 AM
How to determine if I'm running Motif or GTK? DeepSPiN Linux - Newbie 2 01-30-2004 06:02 AM
Looking for app/applet don't know what to call it? Palin Linux - Newbie 3 02-15-2003 01:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration