I am saving some custom created Objects classes (Stream data) to File.
I need to be able to load the contents of the File into a TStringList so I can append a new line to the end of the File, and then Save the changes.
This is not working though because LoadFromFile cannot seem to parse the File correctly. I assume because of the funny characters the Stream Saves to File as, and TStringList expects plain textual information.
How can I do the following:
- Read any Raw Binary File into a TStringList.
- Add my new Line, eg StringList1.Add(MyString);
- Save the Raw Binary File again.
This question actually relates to another question I asked: Save a CRC value in a file, without altering the actual CRC Checksum?
This is what I am trying to do:
- Calculate the CRC Checksum of my Saved Stream File.
- Add the CRC Value to the end of the File.
- Re-save the File.
Then when I attempt to Open my Stream File:
- Assign the CRC Value (at the end of the File) to a variable.
- Delete the CRC Value from the File.
- Save the Stream File as a new Temp File.
- Calculate and Compare the CRC of the Temp File, with the CRC stored in the variable.
- If the CRC of the File matches the internal stored CRC Value, I can process the File as normal.
But I don't know how to Read or Write the Raw Binary Data of the File.
I would be grateful if someone could give me some help and advice thanks :)