How to write a structure to a file and read it back?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
13 views
You need to write a structure to a file, and then again to use it.
struct Lesson { int number; string day; string lessonName; string groupName; string teacher; string classroom; };
by | 13 views

1 Answer

0 like 0 dislike
1. Use the standard ifstream and ofstream
2. Write pocino, for the lines to write first, size_t length, then the line itself
3. To read in the same order as they were written, after reading number the following size_t count size of day, and so on.
by

Related questions

0 like 0 dislike
1 answer
asked Apr 13, 2019 by kytcenochka
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 23, 2019 by DennisKingsman
110,608 questions
257,186 answers
0 comments
35,534 users