BDE 4.14.0 Production release
|
Provide basic platform-independent utilities related to processes.
This component, bdls::ProcessUtil
, defines a platform-independent interface for processes. Currently, it provides a utility to get the current process ID, a utility to get the name of the process, and a utility to get a filename through which the executable can be accessed.
The getProcessName
function is intended to yield a process name that will be meaningful to the programmer, recognizably related to the value of argv[0]
passed to the application, and usually a valid path to the executable file. However, in some cases, especially when argv[0]
was a relative path and the working directory has changed since main
was called, this will not be a usable path for accessing the executable file, and getPathToExecutable
should be used. Note that the return value of getPathToExecutable
may be completely unrelated to the value of argv[0]
passed to main, and the value returned by that function may vary when called multiple times in the same program. getPathToExecutable
will not succeed unless it returns a valid path to the executable file.
This section illustrates intended use of this component.
Get the current process ID:
All calls to getProcessId
will yield the same value:
Get the current process name:
All calls to getProcessName
will yield the same value. Note that if the call does not succeed, processNameB
will not be modified.