Solved

How to get the number of processes

Posted on 1998-08-13
1
152 Views
Last Modified: 2010-04-01
Hi,
     I am writing a C++ program in a Solaris unix environment.
Now my question is how would I write a command in my program to know all the
processes that are running under my userid  presently?

Any help will be greatly appreciated.
Thanks
0
Comment
Question by:singhtaj
1 Comment
 
LVL 1

Accepted Solution

by:
slinky earned 100 total points
ID: 1170263
Run a system call with the following UNIX command

ps -u <userid> | grep -v ps | wc -l

The grep ensures that you don't count the ps command as one of the processes.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question