03-24-2024 12:49 PM
I want to insert a line of text or multiple lines of text into an existing text file.
I don't want to convert the existing text file into an array etc.
would somebody be able to show me an example of that?
I will attach an example of the text file
03-24-2024 03:31 PM
A file is basically just a long string, so unless you append your new lines to the end, many bytes need to rewritten.
The concept of "lines" is just the presence of a special delimiter, e.g. a linefeed.
For anything else, easiest would be to read the entire file as a string, modify it, and write it back to the file. This does not need to have anything to do with arrays.
Please show us your code and explain whet you want to insert and where.
03-25-2024 09:41 AM
Well once again you solved my problem just by simply stating the basic idea in which a text file is simply a continuous string of characters.
Thank you for the excellent help!
Chris