fread and fwrite
Read and write blocks of bytes — ideal for binary data.
Easy
fwrite(samples, sizeof samples[0], n, f) returns the number of items written. Binary files aren't portable across endianness or struct padding.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.