[C++] write everything that exists in list into a file.
Go to solution
Solved by KNG_HOLDY,
1) so if im not wrong you didnt start writting the reading the file part yet right?
if i where you i would start with that
https://thispointer.com/c-how-to-read-a-file-line-by-line-into-a-vector/
2) if you want to understand the code and not just copy & paste i would implement the saving part as followed
open a outputstream like ofstream
itterate through your vector you want to save and write each item in the stream
afterwards close the stream
something like this
ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close();
links: https://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream
http://www.cplusplus.com/doc/tutorial/files/
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now