pack/unpack zero terminated string
Laurent Pointal
laurent.pointal at limsi.fr
Wed May 2 09:59:29 EDT 2007
tmp123 a écrit :
> Hello,
>
> Thanks for your time.
>
> After review the "struct" documentation, it seems there are no option
> to pack/unpack zero terminated strings.
>
> By example, if the packed data contains: byte + zero terminated string
> + zero terminated string + byte, it seems no possible to unpack it
> using "struct".
>
> Please, has someone any hint or pointer to another librarian to be
> used?
May look at ctypes and its c_char_p type
Documentation says:
http://python.net/crew/theller/ctypes/reference.html#fundamental-data-types
c_char_p
Represents the C char * datatype, which must be a pointer to a
zero-terminated string. The constructor accepts an integer address, or a
string.
Note: its in standard libraries from Python 2.5.
More information about the Python-list
mailing list