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 string_collection& 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)
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.h:71
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::collections::generic::list::...
Definition list.h:364
#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:175
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::collections::specialized namespace contains specialized and strongly-typed collections; for ...
Definition string_collection.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10