Solved

How to get the number of processes

Posted on 1998-08-13
1
151 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now