Skip to content

this_process

Alairion edited this page May 8, 2021 · 2 revisions

Name

Defined in header <nes/process.hpp>

namespace this_process{}

Description

nes::this_process namespace represents the current process. It can be used to get the current process id, the current process working directory, and to modify the current process working directory.

Functions

Function Description
get_id Returns the current process's id
working_directory Returns the current process's working directory
change_working_directory Changes the current process's working directory

Example

Here is an example in which we display informations about the process.

main.cpp

#include <iostream>

#include <nes/process.hpp>

int main()
{
    std::cout << "Current process has id " << nes::this_process::get_id() << std::endl; 
    std::cout << "Its current directory is \"" << nes::this_process::working_directory() << "\"" << std::endl;
}

Possible output

Current process has id 42
Its current directory is "/"
Clone this wiki locally