Re: Baby X is bor nagain

Liste des GroupesRevenir à cl c  
Sujet : Re: Baby X is bor nagain
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.c
Date : 19. Jun 2024, 06:39:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4tquf$1qn6n$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Mozilla Thunderbird
On 18/06/2024 17:40, Michael S wrote:
On Tue, 18 Jun 2024 14:36:40 +0200
David Brown <david.brown@hesbynett.no> wrote:
 
>
Of course if you don't know Python, it will be slower to write it in
Python!
>
 I don't know Python well, but it does not meant that I don't know it at
all.
Few minutes ago I took a look into docs and it seems that situation with
writing binary data files with predefined layout is better than what I
was suspecting. They have something called "Buffer Protocol". It allows
to specify layout in declarative manner, similarly to C struct or may
be even to Ada's records with representation clause.
However attempt to read the doc page further down proved that my
suspicion about steepness of the learning curve was not wrong :(
 
"Buffer protocol" is for passing data between Python and C extensions, which is certainly a complicated business.
For dealing with binary data in specific formats in Python, the "struct" module is your friend.  It lets you pack and unpack data with specific sizes and endianness using a compact format string notation.  I've used it for dealing with binary file formats and especially for network packets.  There's also the ctypes module which is aimed at duplicating C-style types and structures, primarily for interfacing with DLL's and dynamic so libraries.

Date Sujet#  Auteur
11 Jun 24 o Re: Baby X is bor nagain319Bonita Montero

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal