Results for “File operations & paths”
Small, practical examples. Search by task or narrow things down below.
Join portable path components
Join portable path components using a complete Go program with explicit sample inputs.
Go✓ Tested
Load a small properties configuration
Java: Use a Reader to make the configuration character encoding explicit.
Java✓ Tested
Normalize relative path components
Java: Path.normalize removes redundant dot components without accessing the filesystem.
Java✓ Tested
Read compressed text directly
Python: Open gzip data in text mode with an explicit encoding.
Python✓ Tested
Read text line by line
Read text line by line using a complete Go program with explicit sample inputs.
Go✓ Tested
Reject an escaping relative path
Reject an escaping relative path using a complete Go program with explicit sample inputs.
Go✓ Tested
Set owner-only read and write permissions
C++: Replace ordinary permission bits with the requested owner permissions.
C++✓ Tested
Write and read binary bytes
Java: Use the byte-oriented Files methods when text encoding should not be involved.
Java✓ Tested
Write and read bytes without text conversion
C++: Use binary stream modes and check each I/O operation before consuming its result.
C++✓ Tested
Append a line to a file
Add a new line to the end of a text file without replacing its existing contents. Append mode also creates the file if it does not exist.
file✓ Tested
Append text to a file
Open a C++ stream in append mode and verify the write.
C++✓ Tested
Chain operations that may return None
Chain operations that may return None in a complete Rust program using the standard library.
Rust✓ Tested