The diary function works well for logging purposes in my application, but instead of latest messages appearing on top of the text file ( this is the way I need it) it appends to older messages.
Any method to pre-append the messages rather than append to older messages in the text file or workarounds ?
Flipping the order should be done in the UI, here no HDD interaction is involved which will make it much faster.
At some point you need to open the logfile and initialize your data structure:
Now read only the new lines. Repeat this cyclic:
To display I recommend to display only the last n (choose a value) lines in your UI to avoid slowing down when the log grows:
Finally, at the end of your program you need to close the file: