Save this video free

10.2 - File I/O (2026-11-02)

Chris Bourke · 39:58 · Watch on YouTube

Part of University of Nebraska-Lincoln CSCE 155E. See all 9 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Chris Bourke introduces C binary file I/O with fwrite and fread, then applies line-based text processing to a Goodreads-derived CSV of books. The exercise uses fgets, strtok, atoi, atof, and deep copies to find the highest-rated book, Thud by Terry Pratchett, and concludes by previewing structures as a way to group each book’s fields.

Key takeaways

Chapters

0:00 Binary Files Store Raw Data Instead of Readable Text
1:10 Writing and Reading Integer Arrays with fwrite and fread
9:08 Inspecting the Goodreads CSV and Reading It with fgets
16:35 Skipping the Header, Newlines, and Empty CSV Rows
20:00 Tokenizing CSV Fields and Preserving Them with Deep Copies
30:21 Parsing Ratings and Tracking the Highest-Rated Book
36:40 Previewing a Book Struct to Group Record Fields

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:02 [music] [music] [music] [music] [music] [music] [music] [music]

0:59 [music] [music] >> All right, so we're going to take a real quick look at binary files. Uh you'll get more practice in your lab tomorrow. Uh but for the most part again, you're going with file IO, you're going to be dealing with uh plain text files uh because if you're going to be dealing with binary files like say image files or a video files or something like that, you generally bring in a library to do it because it's way more complicated, all right? Uh but you can read and write binary. You won't use Fprintf or uh you know, the Fgets or Fgetc. Instead, you use Fwrite to write binary. And there are four

1:48 there are actually four arguments to this function. Uh the first one is buffer. That's the thing that you are actually going to write. The the thing or array or uh element uh that you are writing to a file, right? Uh and then uh the other two are very much like uh like um malloc, uh where you know, you have to specify how many bytes is each thing, and then how many things are there. Like if I was only writing one thing, then the count would be one. But if I were writing an entire array, then the count would be however big the array is. And then the size here, that's the number of bytes that each one takes because it needs to know how many bytes am I actually going to write here. Uh so size is the is the number of bytes each element each

2:37 element takes. So in other words, I use size of, right? Use size of to determine the number of bytes in each one.

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Chris Bourke.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.