OK, I get it now. If there's no way to write list directly into file, I have to write its elements separately, one by one. I did so and it works, when I have to read the list from the file, I just create new objects, give them data from file and create a new list of them. Just thought that there was simpler way.
Thank you.
User Profile
Collapse
-
Do you mean that I should manually write out the content of my objects in the list? I know how to do it, but I just want to save the entire list in one command. Is it possible?Leave a comment:
-
How to write std::list into a file?
Hello. I'm a newbie in C++ file management. I've got a std::list of pointers to objects of my own class (std::list<MyCl ass*>;). Inside my class, there are some strings, ints and methods. I need to save this list into a file, but I don't know how. I've tried fwrite() and WriteFile(), but no results. Could anyone tell me how to save this list into a file? And if I have to use one of these functions, how do I take memory size of my list?
No activity results to display
Show More
Leave a comment: