Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: dealing with binary files
Gerardo Herzig -Departamento de Proyectos Especiales e Internet- Facultad de Medicina
1/7/2008 3:24:00 PM
Tom Brown wrote:
>On Mon, 2008-01-07 at 11:57 -0200, Guilherme Polo wrote:
>
>
>>2008/1/7, Gerardo Herzig <gherzig@fmed.uba.ar>:
>>
>>
>>>Hi all. Im trying to read a binary data from an postgres WAL archive.
>>>If i make a
>>>xfile = open('filename', 'rb').xreadlines()
>>>line = xfile.next()
>>>
>>>i see this sort of thing:
>>>']\xd0\x03\x00\x01\x00\x00\x00\r\x00\x00\x00\x00\x00\x00JM//DI+,D\x00\x00\x00\x01$\x00\x00\x00\x7f\x06\x00\x00y\r\t\x00\x02\x0f\t\x00\x00\x00\x10\x00)\x00\x01\x00\x12\x08
>>>\x00^\xc2\x0c\x00\x08\x00\x00\x003001({\xe8\x10\r\x00\x00\x00\xe4\xff\xffI\x10?l\x01@\x00\x00\x00$\x00\x00\x00\x00\n'
>>>
>>>This file suppose to have some information about database activity, but
>>>at this point i cant do more than this, because i cant figure out what
>>>to do in order to have some 'readable' text.
>>>
>>>Im guessing is some C code, im reading the struct module to see if it
>>>helps, but im not into C programming, and im lost at the start of my
>>>problem.
>>>
>>>
>>You are looking at the correct module, struct. But in order to
>>understand or even correctly extract data from a binary file, you need
>>to know its structure. There should be some document describing the
>>Postgre WAL file format.
>>
>>
>>
>
>"The log record headers are described in access/xlog.h"
>
>
http://www.postgresql.org/docs/8.2/interactive/wal-inte...
>
>
>
Yes Tom, my 'C' comes that far, cant do more, i get quickly
overwelmed...Guess i will have to spend some time reading about it.
Thanks!
Gerardo
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: dealing with binary files
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password