-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab02Driver.cpp
More file actions
32 lines (27 loc) · 1.23 KB
/
Lab02Driver.cpp
File metadata and controls
32 lines (27 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "ReadFile.h"//I modified this one. - D. Smith
#include "WriteFile.h"//slcaneer42
#include "String.h"//Not modified
#include "Tokens.h"//Not sure why this is included at this time
/*********************
Lab1: *
Lab02Driver.cpp *
Samantha Caneer *
Dakota Smith *
*********************/
#include <iostream>//Useful for testing where a program stops during testing, but not needed during the running of the function.
int main()
{
ReadFile* rf = new ReadFile("cds.txt"); //Use of the constructor for ReadFile. Needs new keyword in driver.
WriteFile* wf = new WriteFile("out.txt"); //Use of the constructor for WriteFile. Again a new keyword.
while(!rf->eof())//Loop that runs until the end of the file.
{
String* line = rf->readLine();//Calling the readLine function from the ReadFile class to output a String* type variable
wf->writeLine(line);//Calling the writeFile function to output to a file.
delete line;//Deletes the String* variable.
}
rf->close();//ReadFile class variable calls the close function to close the file and set closed to true
wf->close();//Closes the file being written to.
delete rf;//Delete the ReadFile* variable in order to save space.
delete wf;
return 0;
}