Reading a Binary file

Bigbadborris

Active member
Joined
Aug 21, 2013
Messages
35
Programming Experience
Beginner
HI all

I have a binary file that is created by my companies DOS based software. I would like to know who to read a set number of bytes (620) then write them to a text file and do this for the whole file adding each group of 620 bytes to a new line in the text file.

I have attached a copy of the file i am trying to read

Thank you in advance
 

Attachments

  • CUSTKEY2.txt
    44.8 KB · Views: 81
What exactly are you intending to write to the output file? Do these 620 bytes actually represent text or do you want to convert them to a text representation, e.g. hex or base-64? If it's the former then it's not a binary file to begin with but rather a text file, which seems to be supported by the fact that the file you attached has a ".txt" extension. In that case, why would you read bytes rather than text? If it's the latter then what format do you want to convert it to?
 
HI Thank you for your reply.

The file was created by a database called Filepro that works with our DOS based system. The file consists of customer records each record has 32 Fields of various sizes and the total record length is 620 Characters. I would like to be able to read each customer record and write it to a second file with each record on its own line. Each record has a unique customer number so the next step would be to sort the file into number order.
As you can see from the file attached the file created by filepro adds each record on to the end of the next making it hard to read through.

I hope this makes sense

Many Thanks
 
Back
Top