Hello all. I have a major problem I have not been able to solve by simply googling “C# read binary file” and the like. I’m created a windows application that opens a binary file for reading, and displays the file in regular text into a multiline text box.
I have a binary file that contains rows of data. The data as it was created by the original program looks like the following…(The 4th column is a date that was not able to be copied for whatever reason).
[FONT=Calibri][SIZE=3]“adus”,“flex”,“46.0000000”,"",“2”[/SIZE]
[SIZE=3]“adus”,“fs”,“53.2500000”,"",“2”[/SIZE]
[SIZE=3]“adus”,“nok”,“190.0000000”,"",“2”[/SIZE]
[SIZE=3]“adus”,“nt”,“101.0000000”,"",“2”[/SIZE]
[SIZE=3]“adus”,“sne”,“284.7500000”,"",“2”[/SIZE]
[SIZE=3]“adus”,“vod”,“49.5000000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“035229bp7”,“88.8089000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“459200as0”,“88.5241000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“494368as2”,“86.6703000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“526055aa6”,“102.5000000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“549463ac1”,“88.0223000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“552676al2”,“92.0000000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“580135by6”,“86.8735000”,"",“2”[/SIZE]
[SIZE=3]“cbus”,“816591ae1”,“105.0000000”,"",“2”[/SIZE]
[SIZE=3]“cpus”,“aes.pr.c”,“61.6250000”,"",“2”[/SIZE]
[SIZE=3]“csus”,“adbe”,“67.2500000”,"",“2”[/SIZE]
[SIZE=3]“csus”,“aes”,“74.7500000”,"",“2”[/SIZE]
[SIZE=3]“csus”,“amr”,“67.0000000”,"",“2”[/SIZE]
[SIZE=3]“csus”,“aol”,“75.4375000”,"",“2”[/SIZE]
[SIZE=3]“csus”,“bud”,“70.8750000”,"",“2”[/SIZE]
[SIZE=3]“csus”,“c”,“55.5625000”,"",“2”[/SIZE]
[/FONT]
[FONT=Calibri][SIZE=3]As you can see the 2nd column is not of a fixed width. Also, the saved format of this data is a binary file with the extension .pri. I can read the first and second columns with no problem. The last three columsn diplay nothing but characters…The following is a representation of what I am able to do.[/SIZE][/FONT]
[FONT=Calibri][SIZE=3][/SIZE][/FONT]
adus flexG@???a
adus fs?J@???a
adus nok?g@???a
adus nt@Y@???a
adus sne?q@???a
My next post will contain the code I’m using to read this data and print it.