Hi there, I’m currently doing an assignment at University, I have been set a task that includes loading the contents of a .dat file into an array of records.

So far I’ve managed to get ‘something’ loaded into the array of records, but when this is displayed in a list box, a whole mess of stuff appears, mostly unreadable formatting.

I’m unsure if I’m slipping up loading the .dat into the array, (I have a funny feeling that the fields need to be aligned with how they are presented in the .dat?) or transferring the information from the array to the listbox, I assume it’s the former as I’m confident in the latter.

I don’t suppose theres any tutorials on the web detailing on how to do this, or if anyone can help me out on the forum?

I can provide the code snippets at a later date if its at all helpful, but general pointers would be preferable over a solution (you never know where the lecturers are :P).

Thanks in advance for any help you can give me.

Hi,

There is no standarts specification or .dat extension so it is hard to tell anything without seeing their contents but you have to parse the data from .dat to your records. I can help you more if you send me a sample .dat file but most likely each record is delimited by a CRLF (#13#10) in your .dat file and each field is delimited by tab, space, comma, semi colon, pipe (|) or something similar. You can google CSV parsing on Delphi.

Loren Soth

I do have a delphi routine, that I wrote inconjunction with a friend a while back that can take an ini file and convert it to a .dat file format and encrypts the data (simple encryption)

when run it checks for an ini file which may contain any new or updated information and then modifies the dat file accordingly. if the ini file is not found it just uses the dat file.

it doesn't have the ability to update the records at moment, but could possibly be modified to do that

each record in the ini file is '~' delimitated

let me know if need some code snippet

This article has been dead for over six months. Start a new discussion instead.