Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59322
| References | <CAKuJGC_-i66xtk0aitHKpBQ74ufDKzRn7vXEBjiar+hSGTFZfg@mail.gmail.com> <69l589d5ilgqp6phcj5jn6s9c5220fbbpa@4ax.com> |
|---|---|
| From | "Lakshmipathi.G" <lakshmipathi.g@gmail.com> |
| Date | 2013-11-13 23:29 +0530 |
| Subject | Re: Reading c struct via python |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2543.1384365571.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
> Looks like your "e"... Is that the key field?
Yes, you are right 'e' is the key. And rest of them are data.
>AND the order of the items is "o" before "i"
>-- that doesn't seem to match your C struct definition.
Sorry, I was testing the bdb and while doing that I noticed,
c-struct order is not same as inserted bdb record . But forgot to
fix the struct order before posting it here.
(And also I didn't expect someone will dig this deeper on the binary
string output :p . Thanks for your effort! )
>"s" format in which you precode the length of the string in the
>format ("10s" is a 10 character string), and "p" format in which the first
>byte of the string is the length (0..255) of the rest of the string. The
>struct module doesn't handle C-type null terminated strings directly.
I think we can use 'p' format. (Thus storing the string-length before
actual
string content). That should help us unpack easily.
Thanks Dennis Lee Bieber, for the detailed info and step by step parsing
of the output. It really helped.
--
> Wulfraed Dennis Lee Bieber AF6VN
> wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
----
Cheers,
Lakshmipathi.G
FOSS Programmer.
www.giis.co.in
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Reading c struct via python "Lakshmipathi.G" <lakshmipathi.g@gmail.com> - 2013-11-13 23:29 +0530
csiph-web