Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Extract double in binary file
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Gandalf  
View profile  
 More options Nov 26 2003, 11:01 am
Newsgroups: comp.lang.python
From: Gandalf <gand...@geochemsource.com>
Date: Wed, 26 Nov 2003 16:19:29 +0100
Local: Wed, Nov 26 2003 10:19 am
Subject: Re: Extract double in binary file

>I've a binary file with data in it.
>This file come from an old ms dos application (multilog ~ 1980).
>In this application, a field is declared as a 'decimal' (999 999
>999.99).
>I put 0.00 in the field and save the record to the file.
>When I look in the binary file (with python or an hex editor), the
>field is stored on 8 bytes: 00-00-00-00-00-00-7F-00.
>I try unpack from struct module but the result isn't good.

>Can someone help me?

Most likely it is a BCD field. Please watch for number in the file with
a simple text
viewer. In that case, you can read the number as a string (length is
len('999999999.99')
or similar) and convert it with int() or long().

Cheers,

   L


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.