-
October 13th, 2003, 02:23 AM
#1
How to get Process Id using C
Hello,
My problem is that I wish to extract Process Id using a C/C++ code and that I intend to use AS JNI.
The code that I want should work on Windows and Solaris using #IFDEF... Please can anyone help me out.
-
October 13th, 2003, 02:42 AM
#2
Re: How to get Process Id using C
Originally posted by aagarg
Hello,
My problem is that I wish to extract Process Id using a C/C++ code and that I intend to use AS JNI.
The code that I want should work on Windows and Solaris using #IFDEF... Please can anyone help me out.
Of course, Thouse functions depends on system and they are system calls, not part of c/c++ standard.
For *NIX systems: getpid();
Win : GetProcessId().
"UNIX is simple; it just takes a genius to understand its simplicity!"
-
October 13th, 2003, 02:56 AM
#3
here is one way...
#ifdef WIN32
#define getpid _getpid
#endif
int pid = getpid();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|