Results for “File operations & binary data”
Small, practical examples. Search by task or narrow things down below.
Quote a CSV field and double embedded quotes
C: A quoted CSV field represents a quote character by repeating it.
C✓ Tested
Read a small INI configuration
Python: Use ConfigParser typed accessors for configuration values stored as text.
Python✓ Tested
Read a stream again from its beginning
C: rewind returns a seekable stream to offset zero and clears its error and EOF indicators.
C✓ Tested
Read a tab-separated table
Python: Select a delimiter explicitly rather than splitting lines manually.
Python✓ Tested
Read an ISO-style weekday number
JavaScript: Convert Sunday from zero to seven when using Monday-through-Sunday numbering.
JavaScript✓ Tested
Read an ISO-style weekday number
TypeScript: Convert Sunday from zero to seven when using Monday-through-Sunday numbering.
TypeScript✓ Tested
Read an optional associative-array entry
Bash Scripts: Use a fallback expansion when a map key may not be present under nounset.
Bash Scripts✓ Tested
Read an optional JSON property safely
C#: Use TryGetProperty instead of throwing when an optional property is absent.
C#✓ Tested
Read characters without confusing EOF with a byte
C: Store fgetc in int so every unsigned-char value remains distinguishable from EOF.
C✓ Tested
Read complete lines into an array
Bash Scripts: Mapfile with -t removes each line terminator but preserves other whitespace.
Bash Scripts✓ Tested
Read date components in UTC
JavaScript: UTC accessors avoid differences caused by the machine’s local timezone.
JavaScript✓ Tested
Read date components in UTC
TypeScript: UTC accessors avoid differences caused by the machine’s local timezone.
TypeScript✓ Tested