// justin C. Miller
// 3-29-2001
// made for : http://www.geocities.com/neonprimetime.geo/index.html
// made in: Borland C++ Builder 4.0
// Title: File Input/Output of SENTENCES, ending with a period
//      the deliminator is not read in!!!!!!
// Description: create data file, store 5 sentences
//    read sentences from data file, output them to screen
//    notice infile.getline(char * , long, deliminator)

#include 
#include 
#include 

int main(){
        ofstream outfile ;  // outfile is my output object (just like cout)
        outfile.open("data.dat") ;  // opening my data file (creating new
                                // one if data.dat doesn't exist
        char * sentences[5] = {"neonprimetime is the bomb.",
                                 "neonprimetime loves computers.",
                                 "micky is really cute.",
                                 "indiana pacers rule.",
                                 "deion sanders is fast."} ;
        for(int i = 0 ; i < 5 ; i++)
                outfile << sentences[i] << endl ; // just like cout <<
                                        // i'm sending these names to the data file

        outfile.close() ; // close my data file for output

        ifstream infile ; // infile is my input object (just like cin)
        infile.open("data.dat") ; //opens the data file data.dat for
                                // input purposes, it is the same file
                                // we just outputted to

        char * sentence = new char[30] ;
        cout << "sentences..." << endl ;
        cout << "--------" << endl ;
        for(int j = 1 ; j <= 5 ; j++){
                // notice the next line, a setence can be read
                // in with a simple infile >> sentence
                // because >> stops at white space (so it would only read
                // your first word), thus using getline you can
                // read in until your deliminator which in this case is
                // '.' which means end of the line, so this infile
                // reads into sentence until it hits the '.' or period
                // then you must also catch the end of the line '\n' with a get()
                // (notice the periods will not be read in!)
                //(because they are the deliminator and the deliminator is not read in!)
                infile.getline(sentence, 30, '.');
                infile.get() ;  // must put this extra get() in to catch the '\n'
                                // or the end of the line
                                // otherwise your file will not be read properly
                cout << j << ".) " << sentence << endl ;
        }  // the data file is outputed in a nice formate

        infile.close() ; // close my data file for input

        getch() ;  // pauses the screen for reading purposes

        return 0 ;
}

// OUTPUT LOOKS LIKE...
//        (notice the periods are not there!)
//        (because they were the deliminator and the deliminator is not read in!)

// sentences....
// ---------
// 1.) neonprimetime is the bomb
// 2.) neonprimetime loves computers
// 3.) micky is really cute
// 4.) indiana pacers rule
// 5.) deion sanders is fast

    Source: geocities.com/neonprimetime.geo/cpp/cpp_SourceCode

               ( geocities.com/neonprimetime.geo/cpp)                   ( geocities.com/neonprimetime.geo)