File Handling in C++: Streams, std::filesystem and Practical Examples
File handling in C++ uses the stream classes ifstream, ofstream and fstream. Tested examples cover reading, writing, errors, binary files and C++17.
File handling in C++ uses the stream classes ifstream, ofstream and fstream. Tested examples cover reading, writing, errors, binary files and C++17.
The C++ modulus operator (%) returns the remainder of a division. This guide covers everything — negative numbers, fmod() for decimals, real use cases, and the pitfalls to avoid.
Archived on 1 June 2026, read-only, 797 issues frozen. It still compiles clean on GCC and fails outright on current MSVC. Here is what to do about it.
There are always few little known or hidden features in each programming language. At StackOverflow.com someone started a series of posts “Hidden features of” programming languages. The Hidden Features series is great for people who are new to a certain language.
Eight memory errors that compile cleanly, which tools catch them, and the ownership habits that stop them: new and delete, RAII and smart pointers.
How C++ functions receive arguments and what each way costs, why overloads and defaults fail to compile, and the dangling return that builds anyway.
A unique_ptr is 8 bytes — exactly the same as a raw pointer. Pointers from declaration to ownership, with every claim compiled and measured.
Constructors and destructors in C++ with tested code: initialization order, explicit, = default and = delete, the rule of zero, and virtual destructors.
C++ classes group data with the functions that operate on it. Learn constructors, access specifiers, RAII and more — every example compiled and tested.
One definition, three functions in the binary. A measured guide to templates, from deduction through concepts and the errors they produce.
Fifteen characters cost nothing; sixteen cost a heap allocation. A measured guide to std::string, string_view, and where the copies come from.
Operator overloading in C++ with compiled examples: canonical signatures, member or non-member, defaulted C++20 comparisons, and when not to overload.