FIND YOUR NEXT FEW LINES

Results for “extra”

Small, practical examples. Search by task or narrow things down below.

301 snippets foundClear filters
C++Containers & compound values

Use a last-in first-out stack

C++: Read top before pop because pop does not return the removed value.

C++✓ Tested
CFile positioning & lifecycle

Use an automatically removed temporary file

C: tmpfile creates a binary update stream whose file is removed when closed.

C✓ Tested
CNumeric parsing & arithmetic

Validate a complete floating-point input

C: strtod exposes both the stopping position and range errors; reject nonfinite results when required.

C✓ Tested
C++Text validation & parsing

Validate a complete identifier

C++: regex_match requires the pattern to match the complete input sequence.

C++✓ Tested
CBinary formats & structured parsing

Validate a simple C-style ASCII identifier

C: Check the first character separately from subsequent characters and reject empty input.

C✓ Tested
C++Getting Started

Visit every item in a collection

C++: Print each element in the collection’s original order.

C++✓ Tested
CGetting Started

Visit every item in a collection

C: Print each element in the collection’s original order.

C✓ Tested
C++Tasks & synchronization

Wait for shared state with a condition variable

C++: Use a predicate so spurious wakeups cannot allow the worker to continue before the state is ready.

C++✓ Tested
C++Files & paths

Write a text file

Write and close a C++ output file while checking stream failure.

C++✓ Tested
CFiles

Write a text file

Open, write, and close a C file while checking every operation.

C✓ Tested
CFiles

Write and read binary bytes

Round-trip a byte buffer through a C binary file.

C✓ Tested
C++Filesystem operations

Write and read bytes without text conversion

C++: Use binary stream modes and check each I/O operation before consuming its result.

C++✓ Tested