Lecture 3

Nme iosbinary binary files permit more efficient

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a variable of a numeric type, C++ will automatically “do the right thing.” E.g., if the input contains 234 and III is an integer variable my_file_var >> III // III will contain 234 21 Binary Files • ofstream my_3_file(“dsk.nme”, ios::binary); • Binary files permit more efficient storage of numeric and mixed data • Binary files permit more efficient reading and writing of numeric and mixed data • Binary files CANNOT be read by a human • Binary files CANNOT be edited normally 23 22 File Organization • All but the simplest programs are split into several files. • Header files (.h) contain all declarations needed for compiling OTHER Implementation files (.c). They are included. • Header files contain function Declarations but Constant Definitions and typedefs. 24 Avoiding Multiple Includes To avoid multiple inclusion of the same header file, it is a good idea to bracket it with the following lines: #ifndef some_name // header file text #define some_name #endif 25...
View Full Document

This document was uploaded on 03/31/2014 for the course CS 114 at NJIT.

Ask a homework question - tutors are online