struct.unpack null-terminated string
aleaxit at yahoo.com
Fri Aug 3 14:24:55 CEST 2001
"Xavier Defrang" <xavier at perceval.net> wrote in message
news:mailman.996832925.27921.python-list at python.org...
> How do I unpack a null-terminated string with the struct module? I
> couldn't find it in the lib reference... maybe do i have to upgrade my
I don't think it's supported -- a C struct can't specify that one of
its fields is variable length (e.g. sentinel-terminated). You can
find the \0 and break the string you're unpacking there, etc...
More information about the Python-list