Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include "fileIO.h"
- using namespace std;
- int main() {
- ifstream myRead;
- ofstream myWrite;
- int error;
- error = open("test.txt", myRead, myWrite);
- if(error == 0) {
- cout<<"Sucessfully opened files!";
- }
- else if(error == 1) {
- cout<<"Could not open file for writting.";
- }
- else if(error == 2) {
- cout<<"Could not open file for reading.";
- }
- else if(error == 3) {
- cout<<"Could not open files for reading or writting.";
- }
- else cout<<"Some other error occured.";
- bool torf;
- string message;
- message = "This_is_a_test";
- torf = write(myWrite, message);
- if(torf) {
- cout<<"Sucessfully wrote data.";
- }
- else if(!torf) {
- cout<<"Message could not be outputted.";
- }
- else cout<<"There was some other error.";
- string line;
- line = read(myRead);
- cout<<line;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement