CSC209H1 Lecture Notes - Data File, Errno.H, C String Handling

48 views3 pages
24 Apr 2013
School
Course
Professor

Document Summary

Unix has 2 main mechanisms for managing file access: file pointers: standard i/o library. Reading from file: if we want to read from somewhere other than stdin, we need to open a file. You deal with a pointer to a file structure that contains a: how should we specify the filename in a code? descriptor and a buffer. Use for regular files (more abstract and portable) Allows simple reading/writing/opening/closing: file descriptors: low-level. Each open file is identified by a small integer. Stdin, stdout, stderr: these 3 files are automatically opened for any executing program. These are global variables in the library of type file * (file streams) already open and setup everytime a program is ran: stdin: standard input = reading from the keyboard. File descriptor = 0: stdout: standard output = writing to screen. File descriptor = 1: stderr: standard rrror = write to screen for error messages. File operations: for regular files use from #include

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents