[Tutor] reading binary files

Alan Gauld alan.gauld at btinternet.com
Wed Feb 4 22:36:20 CET 2009


"eShopping" <etrade.griffiths at dsl.pipex.com> wrote

> I now understand why Python gave me the results it did ... it looks 
> like reading the FORTRAN file will be a non-trivial task so probably 
> best to wait until I can post a copy of it.

You don't say which OS you are on but you can read the
binary file into a hex editor and see the structure. If you are on 
*nix
you can use od -x and if on Windows run debug and use the d
command to display the file as hex

Using that you should be able to determine whether fields are
fixed length or delimited by a particular character or tagged
with a length prefix etc.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list