APS106H1 Study Guide - Midterm Guide: Temporary File, Binary File, Scanf Format StringPremium

Applied Science and Engineering
Course Code
Reza Kholghy, Li Shu, Chris Beck, Markus Bussmann
Study Guide

This preview shows pages 1-3. to view the full 32 pages of the document.
University of Toronto (St.George)
APS106 - Fundamentals of Computer
Professor: Reza Kholghy, Li Shu , Chris Beck, Markus
Exam Guide

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

Subscribers Only
Topics Included:
1. Streams
2. File Operations
3. Formatted I/O
4. Character I/O
5. Line I/O
6. Defining and Calling functions
7. Function Declarations
8. Arguments
9. Return Statement
10. Program Termination
11. Recursion
12. One-Dimensional Arrays
13. Multidimensional Arrays
14. Variable-length Arrays
15. One-Dimensional Arrays
16. Multidimensional Arrays
17. Variable-length Arrays

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

Subscribers Only
Chapter 22 Input/Output
22.1 Streams
Streams: means any source of input or any destination for output. E.g. keyboard,
<stdio.h>: stream header, the primary repository of input/output functions.
File Pointer: used to access a stream in a C program, which has type FILE*. Certain
streams are represented by file pointers with standard names
Standard Streams: <stdio. h> provides three standard streams: stdin, stdout,
These streams are ready to use, don’t need to declare, open or close them.
Redirection: Functions like printf, scanf, putchar,getchar,puts and gets, obtain input
form stdin and output to stdout. Generally, stdin represents the keyboard and stdout
represents the screen. But we can force a program to obtain its input from a file
instead of from keyboard using < or >.
If we use output redirection, everything written to stdout is put into a file. By writing error
messages to stderr instead of stdout, we can guarantee those message will appear on the
<stdio.h> supports two kinds of files: text file and binary file.
Text Files: represent characters, easy for human to edit.
Binary Files: bytes don’t necessarily represent characters; groups of bytes
might represent other type of data, such as int and float.
Two special characteristics for text file:
When we write a program that reads from a file or writes to a file, we need to consider whether
FILE *fp1, *fp2;
Below 2 operations are the same.
demo < in.dat >out.dat
demo >out.dat <in.dat>
Text files are divided into lines.
Text files may contain a special “end-of file” marker.
You're Reading a Preview

Unlock to view full version

Subscribers Only