Example_E-1 - /Creatingandreadingbinaryfiles...

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

View Full Document Right Arrow Icon
//Creating and reading binary files  #include <iostream>  #include <fstream>  using namespace std;  struct studentType     char firstName[15];     char lastName[15];     int ID;  };  int main()         //create and initialize an array of students IDs     int studentIDs[5] = {111111, 222222, 333333,                          444444, 555555};             //Line 1          //declare and initialize the struct newStudent     studentType newStudent = {"John", "Wilson",                               777777};                //Line 2     ofstream outFile;                                 //Line 3         //open the output file as a binary file     outFile.open("a:\\ids.dat", ios::binary);         //Line 4 
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/08/2011 for the course CSIT 139 taught by Professor Duzut during the Spring '11 term at Los Angeles City College.

Page1 / 3

Example_E-1 - /Creatingandreadingbinaryfiles...

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

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