CSC151, Class 38: Files Overview: * Review of I/O * Short introduction to files * Lab Notes: * Exam 2 due. * Project proposals assigned * One point of extra credit for attending "Global Communication Technologies and Cultural Exchange", 8pm, Forum South Lounge. * Goldenbergs almost gone. What did you learn yesterday? * I can input and output things in Scheme. Side note: William likes to gamble * Why is this a useful thing to do? Write programs that interact with people? * Another reason: These operations can be used to save information from a program to a file and later read that information back in. * Note: If you're reading from (or writing to) a file you need to know where in the file you are. * Detour: What is a file? A collection of information stored on the hard drive of one or more computers. It's up to you as programmer/computer user to decide what goes in what file. * Where should you normally write to a file? After the last thing you wrote. * Sometimes we want to overwrite. * In Scheme, you convert files to PORTS which have a notion as to where is the next place in the file REFLECTION * Sometimes Sam's mind takes odd paths: Class observe's Sam pausing for no clear reason. "Computer user" -> "I don't like the word user." -> "Why not?" -> "Um ... maybe because it sounds like 'drug user'." -> "Oh yeah! Special on Crank on HBO tonight." "Welcome to Des Moines, Iowa, Small town midwest" * How did you verify sum-of-file? * How did you you write size-of-file? * Did anyone other than Povilas try local kernels? 'Twas brillig and the slithy toves did gyre and gimble in the wabe All mimsy were the borogoves and the mome raths outgrabe. "Beware the Jabberwock, my son, the jaws that bite, the claws that catch. Beware the jubjub bird and shun the frumious bandersnatch." He took his vorpal sword in hand. Long time the manxome foe he sought. So rested he by the tumtum tree, and stood awhile in thought. And as, in uffish thought he stood, the Jabberwock with eyes of flame Came whiffling through the tulgey wood and burbled as it came. One. Two. One. Two. And through and through. The vorpal blade went snicker-snack. He left it dead and with its head he went galumphing back. "And hast thou slain the Jabberwock? Come to my arms, my beamish boy! Oh frabjuous day! Callou! Callay!" he chortled in his joy. 'Twas brillig and the slithy toves did gyre and gimble in the wabe All mimsy were the borogoves and the mome raths outgrabe.