SysGetCurrentProcessId

Table of Contents

SysGetCurrentProcessId

Description

Platform independent method to get current process Id.

Success

Returns current process ID.

Failure

Function cannot fail - always returns valid ID.

Usage example (Cross-references)

    }
    
    unsigned long SysGetCurrentProcessId(void) {
    #ifdef _WIN32
    return (unsigned long)GetCurrentProcessId(); // Windows API
    // generate log file name
    Str file_name = StrInit();
    StrPrintf(&file_name, "%s/misra-%lu-%s", log_dir.data, SysGetCurrentProcessId(), time_buffer);
    fprintf(stderr, "storing logs in %s\n", file_name.data);

Share :

Related Posts

SysGetDirContents

SysGetDirContents Description Read directory contents into a vector. Current contents of the vector will be cleared out.

Read More

SysGetFileSize

SysGetFileSize Description Get size of file without opening it.

Read More