Message from C, C++ discussions

December 2019

— What?


You want to open the file before you do operations on it. You cant say "hey write to this file" if you aren't using it. So what you have right now is fine

— You mean that the file is always in the beginning and after the loop arry ..etc

— No
Open files when u want or write

— It doesnt matter, before you read/write/whatever to a file, you need a file stream or a file descriptor open to deal with it

Message permanent page

— If you want to write at end, open at end

— But before operations on file

— Of course

— Thanks ✨

— If you want a complex example, checkout my school project on file handling:

Message permanent page

— N.B

— It's not good