class: title # File Input and Output ## CSC 161 – March 26, 2026 --- # Agenda for Today 1. Department Events 2. Upcoming Work 3. Discussion 4. Lab 5. Wrap Up --- # Department Events ## CS Extra: Transparency and Accountability in Online Data .indent[ Thursday, March 26th at 4:15pm in Noyce 3821 Refreshments in the CS Commons at 4pm ] ## CS Table: Web Bloat .indent[ Tuesday, March 31st at noon in JRC 224C ] --- class: section blue # Upcoming Work --- # Homework: Lightcycle **Due:** Thursday, April 9th Let's look at a demo together. --- class: section blue # Discussion --- # Discussion: Command-Line Arguments **Items for think, pair, share:** 1. We learned in today's reading that the `main` function takes arguments. What are these arguments, and what do they mean? ```c int main(int argc, char* argv[]); ``` 2. What is the value of `argv[0]` inside of `main` when we run a program like this: ``` $ ./program some_arg another_arg ``` 3. What is the difference between command line arguments and inputs from the user that we can read with `scanf` or `fgets`? --- # Discussion: File Input and Output **Items for think, pair, share:** 1. What is a file? 2. What does it mean to **open** or **close** a file? What functions can we use to open and close files? 3. What does it mean to **read** or **write** a file? What functions can we use to read and write files? 4. Why would a program use files? Try to think of a specific example that isn't from the reading or our lab. --- class: section green # Lab Time --- class: section blue # Wrap Up --- # Wrap Up ## Lab Report Submit your completed maze editor (including file loading and saving) as your week 8 lab report. ## Lightcycle Assignment Start early! I am always happy to discuss your approach to the assignment or any issues you've run into. ## Office Hours I'm happy to meet to discuss how things are going in the class, or to help with specific concepts if you are having trouble. Book a time at
.