Results for “read”
Small, practical examples. Search by task or narrow things down below.
Calculate cumulative totals
C++: partial_sum writes the sum of each input prefix to the output sequence.
C++✓ Tested
Calculate the dot product of two vectors
C++: inner_product multiplies corresponding elements and accumulates them from a chosen seed.
C++✓ Tested
Call a library function
C++: Use a standard absolute-value function with a small negative number.
C++✓ Tested
Capture configuration by value in a callable
C++: A value capture retains the value from lambda creation even if the original variable changes later.
C++✓ Tested
Change visual order without changing DOM order
CSS: Order changes flex painting positions while keyboard and reading order still follow the document.
CSS✓ Tested
Check a literal prefix in C++17
C++: Use string compare because starts_with was introduced after C++17.
C++✓ Tested
Check a literal suffix in C++17
C++: Check lengths before subtracting to avoid an unsigned underflow.
C++✓ Tested
Check an upper integer bound before adding
C++: For these nonnegative values, compare against the maximum minus the addend first.
C++✓ Tested
Check available disk space
Show total, used, and available filesystem space for the current directory in human-readable units.
disk✓ Tested
Check memory usage
Show memory and swap totals in human-readable units. The available column estimates memory usable by new applications.
memory✓ Tested
Check that a file is present and nonempty
Test file content availability before reading it.
file check✓ Tested
Check whether a variable exists under nounset
Bash Scripts: The plus expansion distinguishes an unset variable without reading its missing value.
Bash Scripts✓ Tested