[Drafted Note]
Original question was to keep one file pointer globally(1) or open/close in each call,(2)
Original question was to keep one file pointer globally(1) or open/close in each call,(2)
- Seems (1) is better: https://stackoverflow.com/questions/30255953/open-and-close-of-same-file-multiple-times-vs-opening-file-for-long-time
- Good conversation for (1) but out of the topic https://bytes.com/topic/c-sharp/answers/575619-close-open-file-again-keep-open-log-file
- Don't open them until you want to write to or read from them. They do NOT need to be open all the time, and in fact, this is a dangerous design flaw. https://www.codeproject.com/Questions/304287/How-do-I-keep-open-multiple-StreamWriter-handles
Additional topics:
- http://www.cplusplus.com/forum/beginner/74630/ (yourFile.flush();?)
- Log4net
- http://www.acodersjourney.com/2017/08/top-20-cplusplus-multithreading-mistakes/
- https://www.thegeekstuff.com/2015/01/c-cpp-code-optimization/
No comments:
Post a Comment