How can I get the process name in C? The same name, which is in /proc/$pid/status. I do not want to parse that file. Is there any programmatic way of doing this
/proc/$pid/status
Look at the value of argv[0] which was passed to main. This should be the name under which your process was invoked.
argv[0]
main