xtd 0.2.0
Loading...
Searching...
No Matches
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 std::vector<ustring>& args) {
auto exit_status = args.size() ? xtd::exit_status::failure : exit_status::success;
console::write_line("Before environment::exit(exit_status::{})", exit_status);
environment::exit(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)
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:166
exit_status
Specifies exit status for the xtd::environment::exit method.
Definition exit_status.h:18
@ failure
Unsuccessful execution of a program. Is equal to EXIT_FAILURE.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10