Results for “File operations & binary data”
Small, practical examples. Search by task or narrow things down below.
Calculate an average without integer division truncation
C: Accumulate into double and divide by the nonzero number of readings.
C✓ Tested
Calculate the greatest common divisor
C: Euclid’s algorithm repeatedly replaces a pair with the divisor and remainder.
C✓ Tested
Change a path’s extension
Change a path’s extension in a complete Rust program using the standard library.
Rust✓ Tested
Check exact array membership
Bash Scripts: Compare each element literally instead of searching a concatenated string.
Bash Scripts✓ Tested
Check whether a range is already sorted
C++: is_sorted reports ordering without modifying the input.
C++✓ Tested
Choose Bash with pipefail for build commands
Docker / Compose: SHELL changes the interpreter for subsequent shell-form instructions.
Docker / Compose✓ Tested
Clear a flag without affecting neighboring bits
Arduino / C: bitClear resets only the selected bit.
Arduino / C✓ Tested
Combine a stable entrypoint with default arguments
Docker / Compose: CMD supplies default arguments to an exec-form ENTRYPOINT.
Docker / Compose✓ Tested
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Combine the latest values from observables
Combine the latest values from observables with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Compute a simple XOR checksum
C: XOR all payload bytes into one byte to demonstrate a basic error-detection field.
C✓ Tested
Construct a date from Unix seconds
JavaScript: Multiply seconds by 1000 before creating a Date.
JavaScript✓ Tested