Getting process name in the process 
Author Message
 Getting process name in the process

At first this sounded easier than I thought, or maybe I thought I know C. Anyway, is there anyway
I can get the name of the process that I am executing without using argv ??

Thanks in advance.

--
            __          Chee-Kheong Lin
           / /\
          / /  \        Singapore Networks Operation
  __     /_/ /\ \       Hewlett-Packard Singapore
 /_/\  __\ \ \_\ \      Telephone: +65 279 8648
 \ \ \/ /\\ \ \/ /      Fax      : +65 272 2780
  \ \ \/  \\ \  /

    \ \ \ \ \\ \ \
     \ \ \_\/ \ \ \
      \ \ \    \_\/
       \_\/

"Beer!  Now there's a temporary solution."
                -- Homer in _Homer's_Odyssey_



Tue, 09 Dec 1997 03:00:00 GMT  
 Getting process name in the process


Quote:
>At first this sounded easier than I thought, or maybe I thought I know C.
> Anyway, is there anyway
>I can get the name of the process that I am executing without using argv ??

argv[0] is the standard and therefore portable way, why do you not want to
use it?

--
-----------------------------------------


-----------------------------------------



Tue, 09 Dec 1997 03:00:00 GMT  
 Getting process name in the process

Quote:

>Subject: Getting process name in the process
>Date: 23 Jun 1995 10:17:28 GMT
>At first this sounded easier than I thought, or maybe I thought I know C. Anyway, is there anyway
>I can get the name of the process that I am executing without using argv ??

Not really a C question.  Try a group related to your operating system. This
would also make it easier to answer!

Claude.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 vv    vv       David Claude Brown

 ||     | /
 /\------/
(oo)
(~~)



Wed, 10 Dec 1997 03:00:00 GMT  
 Getting process name in the process

Quote:
> At first this sounded easier than I thought, or maybe I thought I know C.
> Anyway, is there anyway I can get the name of the process that I am
> executing without using argv ??

Sorry, I guess I didn't make my question very clear. I'll try again:

    I'm developing an API, where one of its many functions it has to do is to
    get the name of the process or application that is calling this API, and
    storing the process name into a flat file. Of course the easiest way is to
    design the API such that one of its parameters is the process name which
    can easily be obtained from argv[0].

    So my question is, is there any other way of retrieving the process name
    other than from using argv[0]? Thanks again.

--
            __          Chee-Kheong Lin
           / /\
          / /  \        Singapore Networks Operation
  __     /_/ /\ \       Hewlett-Packard Singapore
 /_/\  __\ \ \_\ \      Telephone: +65 279 8648
 \ \ \/ /\\ \ \/ /      Fax      : +65 272 2780
  \ \ \/  \\ \  /

    \ \ \ \ \\ \ \
     \ \ \_\/ \ \ \
      \ \ \    \_\/
       \_\/

I'll never trust another old person...
            -- Bart realizes Grampa duped him, _War_Of_The_Simpsons_



Fri, 12 Dec 1997 03:00:00 GMT  
 Getting process name in the process

Quote:
>     So my question is, is there any other way of retrieving the process name
>     other than from using argv[0]? Thanks again.

    There's no portable way to do it, but there may well be system-
    specific methods. For example, on a UNIX system you may be able to
    search the output of a "ps" command for a line containing your
    program's process ID.

    So you might like to try a newsgroup that's specific to your
    system to get any magic code that you need.

Quote:
>             __             Chee-Kheong Lin

--

***     "If pigs had wings, bacon'd be more expensive" - Jonas Glim     ***


Sat, 13 Dec 1997 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Getting function name/process from within running process.

2. Solution for retrieving the process name based on its process ID

3. Find out the name of a process (process.exe) from a window handle (CWnd)

4. getting process ID of the current process

5. Getting process ID from process handle

6. getting process name

7. Getting process name 2

8. Q: getting process ID by name?

9. Q: getting process-ID by name?

10. Getting the name of the running processes

11. passing stdin to a forked process, after writing some info to the process

12. process path from process id

 

 
Powered by phpBB® Forum Software