Hi krishna! Welcome to bytes.com!
It's great to have you here! However, this is not really the place for technical questions. For such issues, you should normally post in the
C / C++ Forum or maybe the
Linux / Unix / BSD Forum.
When you post, please always keep to the
Posting Guidelines and when you post code, please post it in
[code] ... [/code] tags.
Now, to answer your question (although it doesn't belong here), have a look at the source code for
pgrep or
unixtop - both do what you want in different ways and both are written in C.
Otherwise, I'll just wish you the best and hope you enjoy being part of
bytes.com!
Greetings,
Nepomuk