FIND YOUR NEXT FEW LINES

Results for “buffer”

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

40 snippets foundClear filters
Arduino / CSerial communication

Collect a serial line in a fixed buffer

Read a short command without dynamic String allocation.

serial line✓ Tested
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
GoTesting & reusable helpers

Compare two byte buffers

Compare two byte buffers using a complete Go program with explicit sample inputs.

Go✓ Tested
Arduino / CEEPROM & program memory

Copy a flash string into a bounded RAM buffer

Arduino / C: strncpy_P reads from program memory into ordinary RAM.

Arduino / C✓ Tested
CStrings

Copy text into a fixed buffer

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

C✓ Tested
CDynamic memory & ownership

Create an independent copy of a byte buffer

C: Allocate the exact byte length and copy only after checking the result.

C✓ Tested
CBinary formats & structured parsing

Encode a byte buffer as hexadecimal

C: Format each byte as an unsigned two-digit hexadecimal value.

C✓ Tested
C++Numeric parsing & calculations

Format an integer into a caller-owned buffer

C++: to_chars avoids allocation and reports whether the buffer was large enough.

C++✓ Tested
Arduino / CText & bounded buffers

Format several integers in a fixed buffer

Arduino / C: snprintf limits writes to the buffer size and includes a terminating null byte.

Arduino / C✓ Tested
CDynamic memory & ownership

Initialize a byte buffer to zero

C: memset initializes each byte to the chosen unsigned-char value.

C✓ Tested
Arduino / CGetting Started

Print a fixed text buffer

Arduino / C: Print a fixed text buffer on an Uno with the Serial Monitor set to 9600 baud.

Arduino / C✓ Tested
GoConcurrency & cancellation

Queue values in a buffered channel

Queue values in a buffered channel using a complete Go program with explicit sample inputs.

Go✓ Tested