FIND YOUR NEXT FEW LINES

Results for “eof”

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

10 snippets foundClear filters
TypeScriptTypes & functions

Narrow a union using typeof

Handle text and numeric values with separate branches.

union✓ Tested
CFile positioning & lifecycle

Read characters without confusing EOF with a byte

C: Store fgetc in int so every unsigned-char value remains distinguishable from EOF.

C✓ Tested
JavaRecords & reliable control flow

Narrow an object with a pattern variable

Java: Pattern matching avoids a separate cast after a successful instanceof check.

Java✓ Tested
CDynamic memory & ownership

Allocate and free a typed array

C: Use sizeof on the pointed-to type and check allocation success before writing.

C✓ Tested
PowerShellDates & numeric validation

Convert Unix seconds into an aware UTC timestamp

PowerShell: DateTimeOffset.FromUnixTimeSeconds creates a value with an explicit UTC offset.

PowerShell✓ Tested
C#Dates & precise numbers

Convert Unix seconds to an offset-aware timestamp

C#: DateTimeOffset preserves the UTC offset explicitly.

C#✓ Tested
CFiles

Count newline characters

Count newline bytes in a C file while retaining EOF as an int.

C✓ Tested
CStructures & function interfaces

Iterate over a fixed array of records

C: Compute the array element count with sizeof at the point where it is still an array.

C✓ 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
CFile positioning & lifecycle

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