Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > reading binary data written in C

Reply
Thread Tools

reading binary data written in C

 
 
Sheldon
Guest
Posts: n/a
 
      03-22-2006
Hi,

I have a script that I want to use to read some binary lon and lat data
that was written with a C program. My script looks like this:

lat = open(lat_file,'rb').read()
lat = Numeric.fromstring(lat)
print len(lat)
print lat[0]

Results:
1476225
-995001790

Or using the Float typecode:
Results:
1476225
-1419.82055664
**************************

Now the length of the string is good, a 1215*1215 array in vector form.
But the lat data is wrong.
I have tried different type codes but nothing gives me a lat that is
within [+90,-90] degrees.
Does anyone know what is going on here?

Thanks,
Sheldon

 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      03-22-2006
On 2006-03-22, Sheldon <(E-Mail Removed)> wrote:

> I have a script that I want to use to read some binary lon and lat data
> that was written with a C program.


http://www.python.org/doc/current/li...le-struct.html

--
Grant Edwards grante Yow! UH-OH!! We're out
at of AUTOMOBILE PARTS and
visi.com RUBBER GOODS!
 
Reply With Quote
 
 
 
 
Sheldon
Guest
Posts: n/a
 
      03-22-2006
Thanks,

I later discovered that it was a big edian binary as well.

Sheldon

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generally, are the programs written by C++ slower than written by C10% ? KaiWen C++ 102 09-14-2011 11:12 PM
fstream data from file, with file periodically written with new data roughtrader C++ 3 02-17-2009 12:42 PM
C++ Reading binary data written by other Language programs Sandeep C++ 3 01-13-2006 07:03 AM
cobol and binary data written by C hpy_awad@yahoo.com C Programming 5 05-10-2004 12:26 AM
Re: Can a usercontrol written in C# be used in Web Forms that is written in VB.Net? Steve C. Orr, MCSD ASP .Net 1 08-24-2003 12:06 AM



Advertisments