enumerate processes

Again for windows I can enumerate processes using toolhelp library

PROCESSENTRY32  pe32 = {0};
    HANDLE           hsp = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );

    pe32.dwSize = sizeof( PROCESSENTRY32 );
    Process32First( hsp, &pe32 );
    do
    {
         // access   PROCESSENTRY32 values
        /*
        DWORD   dwSize;
        DWORD   cntUsage;
        DWORD   th32ProcessID;          // this process
        ULONG_PTR th32DefaultHeapID;
        DWORD   th32ModuleID;           // associated exe
        DWORD   cntThreads;
        DWORD   th32ParentProcessID;    // this process's parent process
        LONG    pcPriClassBase;         // Base priority of process's threads
        DWORD   dwFlags;
        CHAR    szExeFile[MAX_PATH];    // Path
        */

    } while( Process32Next( hsp, &pe32 ) );

Is there any way to do it in linux/unix,. Ineed process ID, parent process Id and process name. I tryes to scan /proc/ folder but I cannot figure out the subfolders and files.

Thank you
The red icon (on the top-left) is a hand or a question mark ? I thought is a Q mark

try man pstat() - this works for some unixes
the /proc file system works for others - Linux is one.

Something like this works with most unix'es and Linux that have /proc:

DIR *procfs;
struct dirent *entry;
procfs = opendir("/proc");
while ( entry = readdir(procfs) ) {
 if (!isdigit(entry->d_name[0])) continue;
 /* process id is in d_name. Open the file /proc/d_name/stat */
}