Skip to content

Commit 805fac4

Browse files
committed
README.md update
1 parent 357c3f7 commit 805fac4

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Python-CStruct
33

44
C-style structs for Python
55

6-
Convert C struct definitions into Python classes with methods for
6+
Convert C struct/union definitions into Python classes with methods for
77
serializing/deserializing.
8-
The usage is very simple: create a class subclassing cstruct.CStruct
9-
and add a C struct definition as a string in the __struct__ field.
10-
The C struct definition is parsed at runtime and the struct format string
8+
The usage is very simple: create a class subclassing cstruct.MemCStruct
9+
and add a C struct/union definition as a string in the __struct__ field.
10+
The C struct/union definition is parsed at runtime and the struct format string
1111
is generated. The class offers the method "unpack" for deserializing
12-
a string of bytes into a Python object and the method "pack" for
13-
serializing the values into a string.
12+
an array of bytes into a Python object and the method "pack" for
13+
serializing the values into an array of bytes.
1414

1515
Example
1616
-------
@@ -21,7 +21,7 @@ The following program reads the DOS partition information from a disk.
2121
#!/usr/bin/env python
2222
import cstruct
2323

24-
class Position(cstruct.CStruct):
24+
class Position(cstruct.MemCStruct):
2525
__byte_order__ = cstruct.LITTLE_ENDIAN
2626
__def__ = """
2727
struct {
@@ -31,7 +31,7 @@ class Position(cstruct.CStruct):
3131
}
3232
"""
3333

34-
class Partition(cstruct.CStruct):
34+
class Partition(cstruct.MemCStruct):
3535
__byte_order__ = cstruct.LITTLE_ENDIAN
3636
__def__ = """
3737
struct {
@@ -52,7 +52,7 @@ class Partition(cstruct.CStruct):
5252
print("starting sector: %08X" % self.start_sect)
5353
print("size MB: %s" % (self.sectors / 2 / 1024))
5454

55-
class MBR(cstruct.CStruct):
55+
class MBR(cstruct.MemCStruct):
5656
__byte_order__ = cstruct.LITTLE_ENDIAN
5757
__def__ = """
5858
struct {

0 commit comments

Comments
 (0)