FIND YOUR NEXT FEW LINES

Results for “save file”

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

1970 snippets foundClear filters
Bash ScriptsInput streams & redirection

Read from a dedicated file descriptor

Bash Scripts: An explicitly opened descriptor keeps the script’s ordinary standard input available.

Bash Scripts✓ Tested
GoFiles & paths

Read from an in-memory filesystem

Read from an in-memory filesystem using a complete Go program with explicit sample inputs.

Go✓ Tested
Bash ScriptsInput streams & redirection

Read null-delimited filenames into an array

Bash Scripts: A null delimiter preserves spaces and embedded newlines in filenames.

Bash Scripts✓ Tested
C++Filesystem operations

Read the byte size of a regular file

C++: file_size reads filesystem metadata without loading file contents.

C++✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Refuse to overwrite an existing file with redirection

Bash Scripts: Noclobber makes a plain greater-than redirection fail when the target already exists.

Bash Scripts✓ Tested
Bash ScriptsVariables & text

Remove a filename extension

Keep the path while removing its final extension.

filename✓ Tested
CFile positioning & lifecycle

Remove one known scratch file

C: Check remove’s return value instead of assuming deletion succeeded.

C✓ Tested
PowerShellFile operations & integrity

Rename a file in its current directory

PowerShell: Rename-Item changes the name without moving the item to another directory.

PowerShell✓ Tested
PythonFile operations & archives

Rename a file within a directory

Python: Use Path.rename and inspect the resulting path.

Python✓ Tested
CFile positioning & lifecycle

Rename a known file

C: The standard rename function reports failure through its return value.

C✓ Tested
C++Filesystem operations

Rename a known file through filesystem

C++: filesystem::rename reports an error by exception when the operation fails.

C++✓ Tested
Bash ScriptsFiles & reliability

Replace a text file with an atomic rename

Prepare new content beside the target before renaming it into place.

atomic write✓ Tested