FIND YOUR NEXT FEW LINES

Results for “print”

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

73 snippets foundClear filters
Bash ScriptsText parsing & arithmetic

Format a numeric label with leading zeroes

Bash Scripts: Use a constant printf format string and supply values as separate arguments.

Bash Scripts✓ Tested
Linux CommandsDates & process utilities

Format a zero-padded numeric label

Linux Commands: Use printf formatting instead of concatenating a variable number of zeroes.

Linux Commands✓ Tested
Linux CommandsArchive integrity & packaging

Archive filenames safely with null delimiters

Linux Commands: Use find -print0 with tar --null to preserve spaces and embedded newlines in filenames.

Linux Commands✓ Tested
CStrings

Copy text into a fixed buffer

Use snprintf and check for truncation when copying a C string.

C✓ Tested
GitCommit history & revision selection

Count commits reachable from a revision

Git: rev-list --count counts reachable commits without printing commit identifiers.

Git✓ Tested
Arduino / CGetting Started

Count five LED flashes with a for loop

Arduino / C: Repeat an LED action a known number of times and print the current count.

Arduino / C✓ Tested
Linux CommandsText processing

Count lines in a file

Count newline characters in a text file, printing only the count without the filename.

lines✓ Tested
C#Collections

Count words with GroupBy

Group repeated C# words and print ordered counts.

C#✓ Tested
Arduino / CText & bounded buffers

Detect truncated formatted output

Arduino / C: snprintf returns the length it would have written, excluding the null terminator.

Arduino / C✓ Tested
Linux CommandsFiles & folders

Find files by extension

Search a directory tree for regular files with a particular extension and print their paths.

find✓ Tested
C#Data & dates

Format a decimal amount

Use invariant culture to print a C# decimal with two places.

C#✓ Tested
CNumbers & memory

Format a decimal value

Print two fractional digits with C printf.

C✓ Tested