Ok I have only recently started with delphi and kind of got thrown in at the deep end so to speak.
I have a blank binary file that needs strings and booleans input from several lists in .txt files at a repetative address. I am not sure how to do this.
For example say the values in the namelist.txt were:
The output binary file needs to be something like this:Code:Paul Michael Andrew Stacy
So it tells the length of the "name" then the "name" and every 36 bytes a name is inputCode:045061756C00000000000000000000000000000000000000000000000000000000000000 074D69636861656C00000000000000000000000000000000000000000000000000000000 06416E647265770000000000000000000000000000000000000000000000000000000000 055374616379000000000000000000000000000000000000000000000000000000000000
Would appreciate it if someone could help me do this.
Thanks a lot
All I can come up with is this, it allows me to write Hello every 8 bytes
This deletes the old file and writes to a new one. Also doesnt allow me to position where the bytes are input to.Code:var binString1, myString2: shortString; binFile : File of string[8]; begin AssignFile(binFile, 'Test.bin'); ReWrite(binFile); binString1 := 'Hello'; binString2 := 'Hello'; Write(binFile, binString1, binString2); CloseFile(binFile); end;
Thanks
Done it now nevermind thanks for reading
That was fast, what was your solution?
It was under my nose the whole time, I just didnt realise it was compatable with binary and strings. I used TMemoryStream, which allowed me to adjust the position and then saved the memory stream to a file.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks