FIND YOUR NEXT FEW LINES

Results for “binary”

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

63 snippets foundClear filters
CStrings & byte buffers

Compare binary buffers including zero bytes

C: memcmp checks an explicit byte length rather than stopping at a string terminator.

C✓ Tested
CFile positioning & lifecycle

Copy a file in bounded binary chunks

C: Check read, write, and close errors while copying without loading the entire file.

C✓ Tested
PythonText validation & encoding

Encode and decode binary data as Base64

Python: Use Base64 when a text format must carry bytes; it is encoding, not encryption.

Python✓ Tested
CFile positioning & lifecycle

Measure a small seekable binary file

C: Seek to the end and inspect ftell, checking both operations for errors.

C✓ Tested
C#JSON & binary formats

Read a big-endian binary integer

C#: Use BinaryPrimitives when the protocol byte order differs from or must not depend on the host.

C#✓ Tested
CFile positioning & lifecycle

Replace bytes at a known position in a binary file

C: Open in update mode and seek before writing a fixed-size replacement.

C✓ Tested
JavaFile operations & binary data

Write and read binary bytes

Java: Use the byte-oriented Files methods when text encoding should not be involved.

Java✓ Tested
CFiles

Write and read binary bytes

Round-trip a byte buffer through a C binary file.

C✓ Tested
JavaEncoding & structured values

Write and read typed binary fields

Java: Data streams use a matching write/read order and fixed encodings for Java primitive values.

Java✓ Tested
Arduino / CBinary values & packets

Assemble a big-endian 16-bit value

Arduino / C: Cast to an unsigned 16-bit type before shifting the high byte.

Arduino / C✓ Tested
Arduino / CBinary values & packets

Assign a bit from a Boolean state

Arduino / C: bitWrite accepts a bit position and a zero or nonzero value.

Arduino / C✓ Tested
Arduino / CBinary values & packets

Calculate a CRC-8 over a byte sequence

Arduino / C: This implementation uses polynomial 0x07, initial zero, and no reflection.

Arduino / C✓ Tested