Thanks all. My internet connection was down so I could not reply. Solution
suggested by Terry using popen() and read argument is right, but I want to
implement without using shell or system() or any other script.
Why do you think you want to do this?
Please understand that when you are responding to Terry, you are talking to one of the small number of individuals tasked with maintaining this particular interface. His word on correct usage is as close to final as anything you're going to get.
Please also understand that the information returned by ps for a process' arguments is not guaranteed to be correct or parseable. If you require a contract with the calling task, you must arrange for the calling task to save the argument information somewhere else. Nico misses the point when complaining that the output is not reliable; it is not meant to be a communcation channel, it is meant to be informative.
On the subject of procfs; folks, you are trying to solve the wrong problem. Adding another access method absent a sensible schema does nothing to address the basic problem.
= Mike