← Back to list

Adventures in C — fread() and fwrite part II

In my previous article, I experimented with the fread() and fwrite() functions. In this article I take the same program a step further and…

Ryan McGovern · 2018-10-08 18:52 · 0 claps · 0.5 min read
#programming #c #fread #fwrite #coding
Open on Medium ↗
Wiki topics: 💻 · Programming 🔬 · Science · General

Adventures in C — fread() and fwrite() part II

In my previous article, I experimented with the fread() and fwrite() functions. In this article I take the same program a step further and abstract out some of the functionality into functions.

[embed]

The program can be run like so:

make books_2

./books_2 myfile.dat w 1 narnia 500

./books_2 myfile.dat r

Outputs: ID: 1, Title: narnia, Number of pages: 500

./books_2 myfile.dat s

Invalid action: w=write, r=read


메타데이터
post_id
5aeff49205ea
slug
adventures-in-c-fread-and-fwrite-part-ii-5aeff49205ea
url
https://medium.com/@rickdiculousryan/adventures-in-c-fread-and-fwrite-part-ii-5aeff49205ea
canonical_url
https://medium.com/@rickdiculousryan/adventures-in-c-fread-and-fwrite-part-ii-5aeff49205ea
author_url
https://medium.com/@rickdiculousryan
status
ok
fetched_at
2026-07-29 23:26:16