lecture18-mar4 - Announcements Lecture 18 Assignment 4...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Announcements Lecture 18 • Assignment 4 – Designs due today in recitation – Q&A • Topics for today – Binary file operations – Random access file operations • Non sequential file operations
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Your DecMack Emulator Your Real Computer DecMack Emulator Program Emulation Result and Execution Profile table How to organize the design of your emulator into modules that reduce the complexity of your program ??? DecMack Machine language program (from a text file on disk)
Background image of page 2
Binary Stream Files A binary stream consists of a sequence of bytes (not necessarily printable characters). Under Windows, there is a difference between text streams and binary streams: – A control-Z character (\x1a) in an input text file is assumed to mark the end of the file. – A new line character (\n) is stored as a single line feed character \n in a binary file; its expanded to \r\n in a text file Under UNIX, there is no difference between a text stream and a binary stream. When a binary file is opened, the mode string should include the letter b: – "rb" Open for reading – "wb" Open for writing (file need not exist) – "ab" Open for appending (file need not exist) – "rb+" Open for reading and writing, starting at beginning – "wb+" Open for reading and writing (create if file not existing) – "ab+" Open for reading and writing (append if file exists)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Binary I/O The fwrite() function writes a block of binary data: size_t fwrite (void * ptr , size_t size , size_t num , FILE * fp ); – fwrite writes num elements (values) of size size to file associated with fp from the location at ptr . – fwrite returns the actual number of elements written.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2010 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas at Austin.

Page1 / 12

lecture18-mar4 - Announcements Lecture 18 Assignment 4...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online