Slide 13.6: EnterBook.cpp
Slide 13.8: InsertIndex.h
Home

InsertBook.h


This code is to append a new book to the book file data.txt.

 ~wenchen/public_html/cgi-bin/351/week13/InsertBook.h 
#include  <fstream>
#include  <iostream>
  using namespace  std;

void  InsertBook( char* title, char* ISBN, char* price, char* quantity ) {
  fstream  book;

  book.open( "data.txt", fstream::app | fstream::out );
  book << title    << "|";
  book << ISBN     << "|";
  book << price    << "|";
  book << quantity << "|" << endl;
  book.close( );
}