Results for “File operations & binary data”
Small, practical examples. Search by task or narrow things down below.
Clean up a temporary directory automatically
Python: Use TemporaryDirectory as a context manager so cleanup also happens after exceptions.
Python✓ Tested
Locate a value in a sorted array
Java: Use Arrays.binarySearch only after establishing ascending order.
Java✓ Tested
Replace a path extension
C#: Path.ChangeExtension transforms a path string without moving or creating a file.
C#✓ Tested
Search a sorted array efficiently
C#: Array.BinarySearch requires an array sorted with the same comparison rules.
C#✓ Tested
Set owner-only read and write permissions
C++: Replace ordinary permission bits with the requested owner permissions.
C++✓ Tested
Borrow local data in a scoped thread
Borrow local data in a scoped thread in a complete Rust program using the standard library.
Rust✓ Tested
Chain operations that may return None
Chain operations that may return None in a complete Rust program using the standard library.
Rust✓ Tested
Choose a local file through a labeled control
HTML: A file input exposes selected file metadata to the page without providing arbitrary filesystem access.
HTML✓ Tested
Detect invalid UTF-8 data
Detect invalid UTF-8 data in a complete Rust program using the standard library.
Rust✓ Tested
Export a container filesystem into a new image
Docker / Compose: export contains filesystem data; import creates a new image from it.
Docker / Compose✓ Tested
Initialize shared data once
Initialize shared data once in a complete Rust program using the standard library.
Rust✓ Tested
Keep scratch data only for the container lifetime
Docker / Compose: Separate tmpfs mounts do not share data between container runs.
Docker / Compose✓ Tested