// 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
// 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
                // '\n' which means end of the line, so this infile
                // reads into sentence until it hits the end of the line
                // if you needed to stop at a ? or ! then just put
                // '!' or '?' instead of '\n'
                infile.getline(sentence, 30, '\n');
                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...

// 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)