i'm new to c++ and i'm trying to get a hang of file i/o. this code is making errors when i try to compile it (main() is yet to be filled):
i'm using visual c++ pro by the way.Code:#include <string> #include <iostream> #include <fstream> using namespace std; void lfuncWrite(string lsFiletowrite, string lsContentstowrite) { ofstream File(lsFiletowrite); //load for output (writing) and delete contents. File << lsContentstowrite; //write. cout << "Done."; } void lfuncRead(string lsFiletoread) { string lsFilecontents; ifstream File(lsFiletoread); File >> lsFilecontents; cout << lsFilecontents; } int main() { return 0; }
thanks.