Aight I'm still new to I/O.. so I was trying to do some things, and its not working out. The only thing I can assume is that it wont let you open close and then reopen the same file in one function, or else I'm missing something here.
Heres my code, I'm trying to basicly take data from 'origFile' and move it to 'saveFile' and then move it back.
I dont know if its necessary to close the files and reopen them.. I just assumed it would be in order for it to understand I want to move things from the in file to the out now. Either way it still gives me the error:Code:int Encrypt (char* inFileName) { ifstream origFile; ofstream saveFile; char outFileName[20] = "data.txt"; char Byte; origFile.open (inFileName, ios::in | ios::binary); saveFile.open (outFileName, ios::out | ios::binary); while (origFile.get(Byte)) { saveFile.put (Byte); } origFile.close(); saveFile.close(); //these 4 lines dont make any difference. saveFile.open (inFileName, ios::out | ios::binary); origFile.open (outFileName, ios::in | ios::binary); while (saveFile.get(Byte)) { //error here origFile.put (Byte); } }
It gave those errors the SECOND time I used them, not the first.. if I dont try and put the data back, no errors occur.Code:60 C:\Projects\inout_encryption.cpp `get' undeclared (first use this function) 61 C:\Projects\inout_encryption.cpp `put' undeclared (first use this function)
Anyone mind helping? thanks