xtd 0.2.0
environment_exit.cpp

Shows how to use xtd::environment::exit method.

#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace environment_exit_code_example {
class program {
public:
// The main entry point for the application.
static auto main(const argument_collection& args) {
console::write_line("Before environment::exit(exit_status::{})", exit_status);
console::write_line("After environment::exit(exit_status::{})", exit_status);
}
};
}
startup_(environment_exit_code_example::program::main);
// This code can be produce the following output :
//
// Before environment::exit(exit_status::success)
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::array::begin(),...
Definition basic_array.hpp:246
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static void exit()
Terminates this process and returns an exit code to the operating system.
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:168
exit_status
Specifies exit status for the xtd::environment::exit method.
Definition exit_status.hpp:18
xtd::array< xtd::string > argument_collection
Represents the collection of arguments passed to the main entry point method.
Definition argument_collection.hpp:19
@ success
Successful execution of a program. Is equal to EXIT_SUCCESS.
Definition exit_status.hpp:20
@ failure
Unsuccessful execution of a program. Is equal to EXIT_FAILURE.
Definition exit_status.hpp:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8