Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.
Scope and conventions
TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.
Compile the next complete example with a C++23-capable compiler. The standard library/toolchain must support the APIs used by later entries.
Fragment
Shell/compiler syntax shown for a Unix-like environment. On Windows, use your installed toolchain and executable naming. Larger projects commonly use CMake or another build system.
main.cpp
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
mkdir hello-clicd hello-cli# Save the CLI example as main.cpp, then:c++ -std=c++23 -Wall -Wextra main.cpp -o hello./hello Ada
C++23 has argc/argv but no standard named-option parser. This minimal manual parser supports only --verbose and rejects other options.
Fragment
Inside main(int argc, char* argv[]), with <string_view>/<stdexcept>. Choose a documented argument library for help, values, short flags and subcommands.
main.cpp
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
#include <stdexcept>#include <string_view>bool verbose = false;for (int i = 1; i < argc; ++i) { std::string_view option(argv[i]); if (option == "--verbose") verbose = true; else throw std::runtime_error("Unknown option");}
C++23 has no portable standard subprocess API with an argument array, captured streams and cancellation. Select a documented library or platform process API for this task.
std::system executes a command through the host environment’s command processor; it is not interchangeable with a structured argv API.
-std selects the language mode; -o names the executable. ./app runs that output. The shown command selects C++23; choose a compiler and standard-library implementation that supports the APIs you use.
Fragment
Separate shell commands; C++23 support varies by compiler (GCC, Clang, MSVC) and standard library (libstdc++, libc++, MSVC STL). The output name is chosen by this command.