FIND YOUR NEXT FEW LINES

Results for “write file”

Small, practical examples. Search by task or narrow things down below.

880 snippets foundClear filters
PowerShellFile operations & integrity

Read a file size in bytes

PowerShell: The Length property of a file item reports its logical byte size.

PowerShell✓ Tested
Bash ScriptsLoops & decisions

Read a file without losing its last line

Handle spaces, backslashes, and a final line without a newline.

read lines✓ Tested
C++Files & paths

Read a filename extension

Extract the final extension from a C++ filesystem path.

C++✓ Tested
C#File operations & paths

Read a filename stem and extension

C#: Use Path helpers instead of splitting a path on dots or directory separators.

C#✓ Tested
PythonJSON & CSV

Read a JSON file

Load a JSON document from disk into Python objects using an explicitly selected text encoding.

json✓ Tested
Docker / ComposeCompose service options

Read a secret from a mounted file

Docker / Compose: Compose secrets make a file available under /run/secrets.

Docker / Compose✓ Tested
PythonFiles & paths

Read a text file

Open a UTF-8 text file and read its contents. A context manager closes the file automatically, even if reading fails.

file✓ Tested
C#Files & paths

Read a text file

Load a small text file into a C# string.

C#✓ Tested
JavaFiles & paths

Read a UTF-8 file

Read a small UTF-8 file into a Java string.

Java✓ Tested
JavaScriptFiles & async

Read a UTF-8 file

Read a small file as text using Node.js.

JavaScript✓ Tested
PowerShellFiles & paths

Read a whole text file

Load text as one string instead of one item per line.

Get-Content✓ Tested
RustFiles & paths

Read buffered lines from a file

Read buffered lines from a file in a complete Rust program using the standard library.

Rust✓ Tested