04-File_IO_1_2spp

04-File_IO_1_2spp - CSC 4304 - Systems Programming Fall...

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

View Full Document Right Arrow Icon
1 CSC 4304 - Systems Programming Fall 2010 Tevfik Ko ! ar Louisiana State University September 2nd, 2010 Lecture - IV File I/O Summary of Last Class • Advanced Structures in C Memory Manipulation in C Parameter Passing Structures Local vs Global Variables Dynamic Memory Management 2
Background image of page 1

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

View Full DocumentRight Arrow Icon
In Today’s Class • File I/O buffered vs unbuffered I/O opening and closing files reading from / writing to files seeking files formatted I/O vs unformatted I/O 3 Buffered vs Unbuffered I/O • Unbuffered I/O: each read write invokes a system call in the kernel. read, write, open, close, lseek • Buffered I/O: data is read/written in optimal-sized chunks from/to disk --> streams standard I/O library written by Dennis Ritchie 4
Background image of page 2
Unbuffered I/O 5 Open a File 6
Background image of page 3

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

View Full DocumentRight Arrow Icon
Open a File 7 Read From a File 8
Background image of page 4
Write into a File 9 Close a File 10
Background image of page 5

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

View Full DocumentRight Arrow Icon
Special Files 11 Seeking a File #include <sys/types.h> #include <unistd.h> off_t lseek(int fd, off_t offset, int whence);
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2011 for the course CSC 4303 taught by Professor Staff during the Fall '10 term at LSU.

Page1 / 17

04-File_IO_1_2spp - CSC 4304 - Systems Programming Fall...

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

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