Let's work with files a bit! Can we open a file and print out the middle third? open lseek read close Note that there are two familes of functions available! Equivalents: Unix stdio open fopen close fclose lseek fseek read fread write fwrite fstat None (platform-specific) So which one do I use? For CS253: unix If you're sure your program runs only on unix: Doesn't really matter If your code needs to run on Windows: stdio Unix file descriptors: Could describe other stuff, like pipes and network sockets So you need to get used to using these That's why we'll use them for CS253 Another way: mmap In case you want to just pretend the file is already in memory A funny use case: Reading a file into a C++ string C++ and C integration: A lot of C++ libraries build on top of C Let's write a library function that might be useful! readlines(filename), returns an STL vector of strings We can use the C++ string constructor's size limit parameter