home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Languages / Python / python-14-src / Doc / libstruct.tex / node1_ct.html < prev    next >
LaTeX Document  |  1997-01-17  |  3.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
90% dexvert Hypertext Markup Language File (text/html) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file HTML document text default (weak)
99% file LaTeX document text default
98% file exported SGML document text default
97% file C source text default
96% file exported SGML document, ASCII text default
80% TrID HyperText Markup Language with DOCTYPE default
19% TrID HyperText Markup Language default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% gt2 HTML (Hyper Text Markup Language) Datei default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime text/html default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3c 21 44 4f 43 54 59 50 | 45 20 48 54 4d 4c 20 50 |<!DOCTYP|E HTML P|
|00000010| 55 42 4c 49 43 20 22 2d | 2f 2f 57 33 43 2f 2f 44 |UBLIC "-|//W3C//D|
|00000020| 54 44 20 48 54 4d 4c 20 | 33 2e 32 20 46 69 6e 61 |TD HTML |3.2 Fina|
|00000030| 6c 2f 2f 65 6e 22 3e 0a | 0a 3c 21 2d 2d 43 6f 6e |l//en">.|.<!--Con|
|00000040| 76 65 72 74 65 64 20 77 | 69 74 68 20 4c 61 54 65 |verted w|ith LaTe|
|00000050| 58 32 48 54 4d 4c 20 32 | 30 32 32 20 28 52 65 6c |X2HTML 2|022 (Rel|
|00000060| 65 61 73 65 64 20 4a 61 | 6e 75 61 72 79 20 31 2c |eased Ja|nuary 1,|
|00000070| 20 32 30 32 32 29 20 2d | 2d 3e 0a 3c 48 54 4d 4c | 2022) -|->.<HTML|
|00000080| 20 6c 61 6e 67 3d 22 65 | 6e 22 3e 0a 3c 48 45 41 | lang="e|n">.<HEA|
|00000090| 44 3e 0a 3c 54 49 54 4c | 45 3e 43 6f 6e 74 65 6e |D>.<TITL|E>Conten|
|000000a0| 74 73 20 6f 66 20 42 75 | 69 6c 74 2d 69 6e 20 4d |ts of Bu|ilt-in M|
|000000b0| 6f 64 75 6c 65 20 73 74 | 72 75 63 74 3c 2f 54 49 |odule st|ruct</TI|
|000000c0| 54 4c 45 3e 0a 0a 3c 4d | 45 54 41 20 48 54 54 50 |TLE>..<M|ETA HTTP|
|000000d0| 2d 45 51 55 49 56 3d 22 | 43 6f 6e 74 65 6e 74 2d |-EQUIV="|Content-|
|000000e0| 54 79 70 65 22 20 43 4f | 4e 54 45 4e 54 3d 22 74 |Type" CO|NTENT="t|
|000000f0| 65 78 74 2f 68 74 6d 6c | 3b 20 63 68 61 72 73 65 |ext/html|; charse|
|00000100| 74 3d 75 74 66 2d 38 22 | 3e 0a 3c 4d 45 54 41 20 |t=utf-8"|>.<META |
|00000110| 4e 41 4d 45 3d 22 76 69 | 65 77 70 6f 72 74 22 20 |NAME="vi|ewport" |
|00000120| 43 4f 4e 54 45 4e 54 3d | 22 77 69 64 74 68 3d 64 |CONTENT=|"width=d|
|00000130| 65 76 69 63 65 2d 77 69 | 64 74 68 2c 20 69 6e 69 |evice-wi|dth, ini|
|00000140| 74 69 61 6c 2d 73 63 61 | 6c 65 3d 31 2e 30 22 3e |tial-sca|le=1.0">|
|00000150| 0a 3c 4d 45 54 41 20 4e | 41 4d 45 3d 22 47 65 6e |.<META N|AME="Gen|
|00000160| 65 72 61 74 6f 72 22 20 | 43 4f 4e 54 45 4e 54 3d |erator" |CONTENT=|
|00000170| 22 4c 61 54 65 58 32 48 | 54 4d 4c 20 76 32 30 32 |"LaTeX2H|TML v202|
|00000180| 32 22 3e 0a 0a 3c 4c 49 | 4e 4b 20 52 45 4c 3d 22 |2">..<LI|NK REL="|
|00000190| 53 54 59 4c 45 53 48 45 | 45 54 22 20 48 52 45 46 |STYLESHE|ET" HREF|
|000001a0| 3d 22 6c 69 62 73 74 72 | 75 63 74 2e 63 73 73 22 |="libstr|uct.css"|
|000001b0| 3e 0a 0a 3c 4c 49 4e 4b | 20 52 45 4c 3d 22 70 72 |>..<LINK| REL="pr|
|000001c0| 65 76 69 6f 75 73 22 20 | 48 52 45 46 3d 22 6c 69 |evious" |HREF="li|
|000001d0| 62 73 74 72 75 63 74 5f | 6d 6e 2e 68 74 6d 6c 22 |bstruct_|mn.html"|
|000001e0| 3e 0a 3c 4c 49 4e 4b 20 | 52 45 4c 3d 22 75 70 22 |>.<LINK |REL="up"|
|000001f0| 20 48 52 45 46 3d 22 6c | 69 62 73 74 72 75 63 74 | HREF="l|ibstruct|
|00000200| 5f 6d 6e 2e 68 74 6d 6c | 22 3e 0a 3c 2f 48 45 41 |_mn.html|">.</HEA|
|00000210| 44 3e 0a 20 0a 3c 42 4f | 44 59 20 62 67 63 6f 6c |D>. .<BO|DY bgcol|
|00000220| 6f 72 3d 22 23 66 66 66 | 66 66 66 22 20 74 65 78 |or="#fff|fff" tex|
|00000230| 74 3d 22 23 30 30 30 30 | 30 30 22 20 6c 69 6e 6b |t="#0000|00" link|
|00000240| 3d 22 23 39 39 34 34 45 | 45 22 20 76 6c 69 6e 6b |="#9944E|E" vlink|
|00000250| 3d 22 23 30 30 30 30 66 | 66 22 20 61 6c 69 6e 6b |="#0000f|f" alink|
|00000260| 3d 22 23 30 30 66 66 30 | 30 22 3e 0a 0a 3c 48 31 |="#00ff0|0">..<H1|
|00000270| 3e 3c 41 20 49 44 3d 22 | 53 45 43 54 49 4f 4e 30 |><A ID="|SECTION0|
|00000280| 30 30 31 30 30 30 30 30 | 30 30 30 30 30 30 30 30 |00100000|00000000|
|00000290| 30 30 30 22 3e 0a 42 75 | 69 6c 74 2d 69 6e 20 4d |000">.Bu|ilt-in M|
|000002a0| 6f 64 75 6c 65 20 73 74 | 72 75 63 74 3c 2f 41 3e |odule st|ruct</A>|
|000002b0| 0a 3c 2f 48 31 3e 0a 73 | 74 72 75 63 74 0a 43 73 |.</H1>.s|truct.Cs|
|000002c0| 74 72 75 63 74 75 72 65 | 73 0a 0a 3c 50 3e 0a 54 |tructure|s..<P>.T|
|000002d0| 68 69 73 20 6d 6f 64 75 | 6c 65 20 70 65 72 66 6f |his modu|le perfo|
|000002e0| 72 6d 73 20 63 6f 6e 76 | 65 72 73 69 6f 6e 73 20 |rms conv|ersions |
|000002f0| 62 65 74 77 65 65 6e 20 | 50 79 74 68 6f 6e 20 76 |between |Python v|
|00000300| 61 6c 75 65 73 20 61 6e | 64 20 43 0a 73 74 72 75 |alues an|d C.stru|
|00000310| 63 74 73 20 72 65 70 72 | 65 73 65 6e 74 65 64 20 |cts repr|esented |
|00000320| 61 73 20 50 79 74 68 6f | 6e 20 73 74 72 69 6e 67 |as Pytho|n string|
|00000330| 73 2e 20 20 49 74 20 75 | 73 65 73 20 66 6f 72 6d |s. It u|ses form|
|00000340| 61 74 20 73 74 72 69 6e | 67 73 0a 28 65 78 70 6c |at strin|gs.(expl|
|00000350| 61 69 6e 65 64 20 62 65 | 6c 6f 77 29 20 61 73 20 |ained be|low) as |
|00000360| 63 6f 6d 70 61 63 74 20 | 64 65 73 63 72 69 70 74 |compact |descript|
|00000370| 69 6f 6e 73 20 6f 66 20 | 74 68 65 20 6c 61 79 2d |ions of |the lay-|
|00000380| 6f 75 74 20 6f 66 20 74 | 68 65 20 43 0a 73 74 72 |out of t|he C.str|
|00000390| 75 63 74 73 20 61 6e 64 | 20 74 68 65 20 69 6e 74 |ucts and| the int|
|000003a0| 65 6e 64 65 64 20 63 6f | 6e 76 65 72 73 69 6f 6e |ended co|nversion|
|000003b0| 20 74 6f 2f 66 72 6f 6d | 20 50 79 74 68 6f 6e 20 | to/from| Python |
|000003c0| 76 61 6c 75 65 73 2e 0a | 0a 3c 50 3e 0a 53 65 65 |values..|.<P>.See|
|000003d0| 20 61 6c 73 6f 20 62 75 | 69 6c 74 2d 69 6e 20 6d | also bu|ilt-in m|
|000003e0| 6f 64 75 6c 65 20 61 72 | 72 61 79 2e 0a 61 72 72 |odule ar|ray..arr|
|000003f0| 61 79 0a 0a 3c 50 3e 0a | 54 68 65 20 6d 6f 64 75 |ay..<P>.|The modu|
|00000400| 6c 65 20 64 65 66 69 6e | 65 73 20 74 68 65 20 66 |le defin|es the f|
|00000410| 6f 6c 6c 6f 77 69 6e 67 | 20 65 78 63 65 70 74 69 |ollowing| excepti|
|00000420| 6f 6e 20 61 6e 64 20 66 | 75 6e 63 74 69 6f 6e 73 |on and f|unctions|
|00000430| 3a 0a 0a 3c 50 3e 0a 0a | 3c 42 52 3e 0a 3c 49 4d |:..<P>..|<BR>.<IM|
|00000440| 47 0a 20 20 53 54 59 4c | 45 3d 22 68 65 69 67 68 |G. STYL|E="heigh|
|00000450| 74 3a 20 31 39 36 2e 32 | 35 65 78 3b 20 76 65 72 |t: 196.2|5ex; ver|
|00000460| 74 69 63 61 6c 2d 61 6c | 69 67 6e 3a 20 2d 30 2e |tical-al|ign: -0.|
|00000470| 35 37 65 78 3b 20 22 20 | 53 52 43 3d 22 69 6d 67 |57ex; " |SRC="img|
|00000480| 31 2e 70 6e 67 22 0a 20 | 41 4c 54 3d 22 5c 62 65 |1.png". |ALT="\be|
|00000490| 67 69 6e 7b 65 78 63 64 | 65 73 63 7d 7b 65 72 72 |gin{excd|esc}{err|
|000004a0| 6f 72 7d 0a 45 78 63 65 | 70 74 69 6f 6e 20 72 61 |or}.Exce|ption ra|
|000004b0| 69 73 65 64 20 6f 6e 20 | 76 61 72 69 6f 75 73 20 |ised on |various |
|000004c0| 6f 63 63 61 73 69 6f 6e | 73 3b 20 61 72 67 75 6d |occasion|s; argum|
|000004d0| 65 6e 74 20 69 73 20 61 | 20 73 74 72 69 6e 67 0a |ent is a| string.|
|000004e0| 64 65 73 63 72 69 62 69 | 6e 67 20 77 68 61 74 20 |describi|ng what |
|000004f0| 69 73 20 77 72 6f 6e 67 | 2e 0a 5c 65 6e 64 7b 65 |is wrong|..\end{e|
|00000500| 78 63 64 65 73 63 7d 22 | 3e 0a 3c 42 52 3e 0a 0a |xcdesc}"|>.<BR>..|
|00000510| 3c 50 3e 0a 3c 42 52 3e | 0a 3c 49 4d 47 0a 20 20 |<P>.<BR>|.<IMG. |
|00000520| 53 54 59 4c 45 3d 22 68 | 65 69 67 68 74 3a 20 32 |STYLE="h|eight: 2|
|00000530| 2e 31 30 65 78 3b 20 76 | 65 72 74 69 63 61 6c 2d |.10ex; v|ertical-|
|00000540| 61 6c 69 67 6e 3a 20 31 | 37 36 2e 36 38 65 78 3b |align: 1|76.68ex;|
|00000550| 20 22 20 53 52 43 3d 22 | 69 6d 67 32 2e 70 6e 67 | " SRC="|img2.png|
|00000560| 22 0a 20 41 4c 54 3d 22 | 5c 62 65 67 69 6e 7b 66 |". ALT="|\begin{f|
|00000570| 75 6e 63 64 65 73 63 7d | 7b 70 61 63 6b 7d 7b 66 |uncdesc}|{pack}{f|
|00000580| 6d 74 5c 2c 20 76 31 5c | 2c 20 76 32 5c 2c 20 7b |mt\, v1\|, v2\, {|
|00000590| 5c 72 6d 5c 6c 64 6f 74 | 73 7d 7d 0a 52 65 74 75 |\rm\ldot|s}}.Retu|
|000005a0| 72 6e 20 61 20 73 74 72 | 69 6e 67 20 63 6f 6e 74 |rn a str|ing cont|
|000005b0| 61 69 6e 69 6e 67 20 2e | 2e 2e 0a 2e 2e 2e 20 61 |aining .|...... a|
|000005c0| 72 67 75 6d 65 6e 74 73 | 20 6d 75 73 74 20 6d 61 |rguments| must ma|
|000005d0| 74 63 68 20 74 68 65 20 | 76 61 6c 75 65 73 20 72 |tch the |values r|
|000005e0| 65 71 75 69 72 65 64 20 | 62 79 20 74 68 65 20 66 |equired |by the f|
|000005f0| 6f 72 6d 61 74 0a 65 78 | 61 63 74 6c 79 2e 0a 5c |ormat.ex|actly..\|
|00000600| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 22 3e 0a |end{func|desc}">.|
|00000610| 3c 42 52 3e 0a 0a 3c 50 | 3e 0a 3c 42 52 3e 0a 3c |<BR>..<P|>.<BR>.<|
|00000620| 49 4d 47 0a 20 20 53 54 | 59 4c 45 3d 22 68 65 69 |IMG. ST|YLE="hei|
|00000630| 67 68 74 3a 20 32 2e 31 | 37 65 78 3b 20 76 65 72 |ght: 2.1|7ex; ver|
|00000640| 74 69 63 61 6c 2d 61 6c | 69 67 6e 3a 20 31 37 36 |tical-al|ign: 176|
|00000650| 2e 35 35 65 78 3b 20 22 | 20 53 52 43 3d 22 69 6d |.55ex; "| SRC="im|
|00000660| 67 33 2e 70 6e 67 22 0a | 20 41 4c 54 3d 22 5c 62 |g3.png".| ALT="\b|
|00000670| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 75 |egin{fun|cdesc}{u|
|00000680| 6e 70 61 63 6b 7d 7b 66 | 6d 74 5c 2c 20 73 74 72 |npack}{f|mt\, str|
|00000690| 69 6e 67 7d 0a 55 6e 70 | 61 63 6b 20 74 68 65 20 |ing}.Unp|ack the |
|000006a0| 73 74 72 69 6e 67 20 28 | 70 72 65 73 75 6d 61 62 |string (|presumab|
|000006b0| 6c 79 20 70 61 63 6b 65 | 64 20 62 79 20 2e 2e 2e |ly packe|d by ...|
|000006c0| 0a 2e 2e 2e 5c 63 6f 64 | 65 7b 6c 65 6e 28 5c 76 |....\cod|e{len(\v|
|000006d0| 61 72 7b 73 74 72 69 6e | 67 7d 29 7d 20 6d 75 73 |ar{strin|g})} mus|
|000006e0| 74 0a 65 71 75 61 6c 20 | 5c 63 6f 64 65 7b 63 61 |t.equal |\code{ca|
|000006f0| 6c 63 73 69 7a 65 28 5c | 76 61 72 7b 66 6d 74 7d |lcsize(\|var{fmt}|
|00000700| 29 7d 29 2e 0a 5c 65 6e | 64 7b 66 75 6e 63 64 65 |)})..\en|d{funcde|
|00000710| 73 63 7d 22 3e 0a 3c 42 | 52 3e 0a 0a 3c 50 3e 0a |sc}">.<B|R>..<P>.|
|00000720| 3c 42 52 3e 0a 3c 49 4d | 47 0a 20 20 53 54 59 4c |<BR>.<IM|G. STYL|
|00000730| 45 3d 22 68 65 69 67 68 | 74 3a 20 32 2e 33 38 65 |E="heigh|t: 2.38e|
|00000740| 78 3b 20 76 65 72 74 69 | 63 61 6c 2d 61 6c 69 67 |x; verti|cal-alig|
|00000750| 6e 3a 20 31 37 36 2e 32 | 37 65 78 3b 20 22 20 53 |n: 176.2|7ex; " S|
|00000760| 52 43 3d 22 69 6d 67 34 | 2e 70 6e 67 22 0a 20 41 |RC="img4|.png". A|
|00000770| 4c 54 3d 22 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |LT="\beg|in{funcd|
|00000780| 65 73 63 7d 7b 63 61 6c | 63 73 69 7a 65 7d 7b 66 |esc}{cal|csize}{f|
|00000790| 6d 74 7d 0a 52 65 74 75 | 72 6e 20 74 68 65 20 73 |mt}.Retu|rn the s|
|000007a0| 69 7a 65 20 6f 66 20 74 | 68 65 20 73 74 72 75 63 |ize of t|he struc|
|000007b0| 74 20 28 61 6e 64 20 68 | 65 6e 63 65 20 6f 66 20 |t (and h|ence of |
|000007c0| 74 68 65 20 73 74 72 69 | 6e 67 29 0a 63 6f 72 72 |the stri|ng).corr|
|000007d0| 65 73 70 6f 6e 64 69 6e | 67 20 74 6f 20 74 68 65 |espondin|g to the|
|000007e0| 20 67 69 76 65 6e 20 66 | 6f 72 6d 61 74 2e 0a 5c | given f|ormat..\|
|000007f0| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 22 3e 0a |end{func|desc}">.|
|00000800| 3c 42 52 3e 0a 0a 3c 50 | 3e 0a 46 6f 72 6d 61 74 |<BR>..<P|>.Format|
|00000810| 20 63 68 61 72 61 63 74 | 65 72 73 20 68 61 76 65 | charact|ers have|
|00000820| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6d | the fol|lowing m|
|00000830| 65 61 6e 69 6e 67 3b 20 | 74 68 65 20 63 6f 6e 76 |eaning; |the conv|
|00000840| 65 72 73 69 6f 6e 20 62 | 65 74 77 65 65 6e 20 43 |ersion b|etween C|
|00000850| 0a 61 6e 64 20 50 79 74 | 68 6f 6e 20 76 61 6c 75 |.and Pyt|hon valu|
|00000860| 65 73 20 73 68 6f 75 6c | 64 20 62 65 20 6f 62 76 |es shoul|d be obv|
|00000870| 69 6f 75 73 20 67 69 76 | 65 6e 20 74 68 65 69 72 |ious giv|en their|
|00000880| 20 74 79 70 65 73 3a 0a | 0a 3c 50 3e 0a 3c 42 52 | types:.|.<P>.<BR|
|00000890| 3e 0a 3c 49 4d 47 0a 20 | 53 54 59 4c 45 3d 22 68 |>.<IMG. |STYLE="h|
|000008a0| 65 69 67 68 74 3a 20 33 | 31 34 2e 30 30 65 78 3b |eight: 3|14.00ex;|
|000008b0| 20 22 20 53 52 43 3d 22 | 69 6d 67 35 2e 70 6e 67 | " SRC="|img5.png|
|000008c0| 22 0a 20 41 4c 54 3d 22 | 5c 62 65 67 69 6e 7b 74 |". ALT="|\begin{t|
|000008d0| 61 62 6c 65 69 69 69 7d | 7b 5c 76 65 72 74 20 63 |ableiii}|{\vert c|
|000008e0| 5c 76 65 72 74 20 6c 5c | 76 65 72 74 20 6c 5c 76 |\vert l\|vert l\v|
|000008f0| 65 72 74 7d 7b 73 61 6d | 70 7d 7b 46 6f 72 6d 61 |ert}{sam|p}{Forma|
|00000900| 74 7d 7b 43 7d 7b 50 79 | 74 68 6f 6e 7d 0a 5c 6c |t}{C}{Py|thon}.\l|
|00000910| 69 6e 65 69 69 69 7b 2e | 2e 2e 0a 2e 2e 2e 7d 7b |ineiii{.|......}{|
|00000920| 69 6e 74 65 67 65 72 7d | 0a 5c 6c 69 6e 65 69 69 |integer}|.\lineii|
|00000930| 69 7b 66 7d 7b 66 6c 6f | 61 74 7d 7b 66 6c 6f 61 |i{f}{flo|at}{floa|
|00000940| 74 7d 0a 5c 6c 69 6e 65 | 69 69 69 7b 64 7d 7b 64 |t}.\line|iii{d}{d|
|00000950| 6f 75 62 6c 65 7d 7b 66 | 6c 6f 61 74 7d 0a 5c 65 |ouble}{f|loat}.\e|
|00000960| 6e 64 7b 74 61 62 6c 65 | 69 69 69 7d 22 3e 0a 3c |nd{table|iii}">.<|
|00000970| 42 52 3e 0a 0a 3c 50 3e | 0a 41 20 66 6f 72 6d 61 |BR>..<P>|.A forma|
|00000980| 74 20 63 68 61 72 61 63 | 74 65 72 20 6d 61 79 20 |t charac|ter may |
|00000990| 62 65 20 70 72 65 63 65 | 64 65 64 20 62 79 20 61 |be prece|ded by a|
|000009a0| 6e 20 69 6e 74 65 67 72 | 61 6c 20 72 65 70 65 61 |n integr|al repea|
|000009b0| 74 20 63 6f 75 6e 74 3b | 20 65 2e 67 2e 20 74 68 |t count;| e.g. th|
|000009c0| 65 20 66 6f 72 6d 61 74 | 20 73 74 72 69 6e 67 20 |e format| string |
|000009d0| 27 34 68 27 20 6d 65 61 | 6e 73 20 65 78 61 63 74 |'4h' mea|ns exact|
|000009e0| 6c 79 20 74 68 65 20 73 | 61 6d 65 20 61 73 20 27 |ly the s|ame as '|
|000009f0| 68 68 68 68 27 2e 0a 0a | 3c 50 3e 0a 43 20 6e 75 |hhhh'...|<P>.C nu|
|00000a00| 6d 62 65 72 73 20 61 72 | 65 20 72 65 70 72 65 73 |mbers ar|e repres|
|00000a10| 65 6e 74 65 64 20 69 6e | 20 74 68 65 20 6d 61 63 |ented in| the mac|
|00000a20| 68 69 6e 65 27 73 20 6e | 61 74 69 76 65 20 66 6f |hine's n|ative fo|
|00000a30| 72 6d 61 74 20 61 6e 64 | 20 62 79 74 65 0a 6f 72 |rmat and| byte.or|
|00000a40| 64 65 72 2c 20 61 6e 64 | 20 70 72 6f 70 65 72 6c |der, and| properl|
|00000a50| 79 20 61 6c 69 67 6e 65 | 64 20 62 79 20 73 6b 69 |y aligne|d by ski|
|00000a60| 70 70 69 6e 67 20 70 61 | 64 20 62 79 74 65 73 20 |pping pa|d bytes |
|00000a70| 69 66 20 6e 65 63 65 73 | 73 61 72 79 0a 28 61 63 |if neces|sary.(ac|
|00000a80| 63 6f 72 64 69 6e 67 20 | 74 6f 20 74 68 65 20 72 |cording |to the r|
|00000a90| 75 6c 65 73 20 75 73 65 | 64 20 62 79 20 74 68 65 |ules use|d by the|
|00000aa0| 20 43 20 63 6f 6d 70 69 | 6c 65 72 29 2e 0a 0a 3c | C compi|ler)...<|
|00000ab0| 50 3e 0a 45 78 61 6d 70 | 6c 65 73 20 28 61 6c 6c |P>.Examp|les (all|
|00000ac0| 20 6f 6e 20 61 20 62 69 | 67 2d 65 6e 64 69 61 6e | on a bi|g-endian|
|00000ad0| 20 6d 61 63 68 69 6e 65 | 29 3a 0a 0a 3c 50 3e 0a | machine|):..<P>.|
|00000ae0| 3c 50 52 45 3e 0a 70 61 | 63 6b 28 27 68 68 6c 27 |<PRE>.pa|ck('hhl'|
|00000af0| 2c 20 31 2c 20 32 2c 20 | 33 29 20 3d 3d 20 27 5c |, 1, 2, |3) == '\|
|00000b00| 30 30 30 5c 30 30 31 5c | 30 30 30 5c 30 30 32 5c |000\001\|000\002\|
|00000b10| 30 30 30 5c 30 30 30 5c | 30 30 30 5c 30 30 33 27 |000\000\|000\003'|
|00000b20| 0a 75 6e 70 61 63 6b 28 | 27 68 68 6c 27 2c 20 27 |.unpack(|'hhl', '|
|00000b30| 5c 30 30 30 5c 30 30 31 | 5c 30 30 30 5c 30 30 32 |\000\001|\000\002|
|00000b40| 5c 30 30 30 5c 30 30 30 | 5c 30 30 30 5c 30 30 33 |\000\000|\000\003|
|00000b50| 27 29 20 3d 3d 20 28 31 | 2c 20 32 2c 20 33 29 0a |') == (1|, 2, 3).|
|00000b60| 63 61 6c 63 73 69 7a 65 | 28 27 68 68 6c 27 29 20 |calcsize|('hhl') |
|00000b70| 3d 3d 20 38 0a 3c 2f 50 | 52 45 3e 0a 0a 3c 50 3e |== 8.</P|RE>..<P>|
|00000b80| 0a 48 69 6e 74 3a 20 74 | 6f 20 61 6c 69 67 6e 20 |.Hint: t|o align |
|00000b90| 74 68 65 20 65 6e 64 20 | 6f 66 20 61 20 73 74 72 |the end |of a str|
|00000ba0| 75 63 74 75 72 65 20 74 | 6f 20 74 68 65 20 61 6c |ucture t|o the al|
|00000bb0| 69 67 6e 6d 65 6e 74 20 | 72 65 71 75 69 72 65 6d |ignment |requirem|
|00000bc0| 65 6e 74 20 6f 66 0a 61 | 20 70 61 72 74 69 63 75 |ent of.a| particu|
|00000bd0| 6c 61 72 20 74 79 70 65 | 2c 20 65 6e 64 20 74 68 |lar type|, end th|
|00000be0| 65 20 66 6f 72 6d 61 74 | 20 77 69 74 68 20 74 68 |e format| with th|
|00000bf0| 65 20 63 6f 64 65 20 66 | 6f 72 20 74 68 61 74 20 |e code f|or that |
|00000c00| 74 79 70 65 20 77 69 74 | 68 20 61 0a 72 65 70 65 |type wit|h a.repe|
|00000c10| 61 74 20 63 6f 75 6e 74 | 20 6f 66 20 7a 65 72 6f |at count| of zero|
|00000c20| 2c 20 65 2e 67 2e 20 74 | 68 65 20 66 6f 72 6d 61 |, e.g. t|he forma|
|00000c30| 74 20 27 6c 6c 68 30 6c | 27 20 73 70 65 63 69 66 |t 'llh0l|' specif|
|00000c40| 69 65 73 20 74 77 6f 0a | 70 61 64 20 62 79 74 65 |ies two.|pad byte|
|00000c50| 73 20 61 74 20 74 68 65 | 20 65 6e 64 2c 20 61 73 |s at the| end, as|
|00000c60| 73 75 6d 69 6e 67 20 6c | 6f 6e 67 73 20 61 72 65 |suming l|ongs are|
|00000c70| 20 61 6c 69 67 6e 65 64 | 20 6f 6e 20 34 2d 62 79 | aligned| on 4-by|
|00000c80| 74 65 20 62 6f 75 6e 64 | 61 72 69 65 73 2e 0a 0a |te bound|aries...|
|00000c90| 3c 50 3e 0a 28 4d 6f 72 | 65 20 66 6f 72 6d 61 74 |<P>.(Mor|e format|
|00000ca0| 20 63 68 61 72 61 63 74 | 65 72 73 20 61 72 65 20 | charact|ers are |
|00000cb0| 70 6c 61 6e 6e 65 64 2c | 20 65 2e 67 2e 20 27 73 |planned,| e.g. 's|
|00000cc0| 27 20 66 6f 72 20 63 68 | 61 72 61 63 74 65 72 0a |' for ch|aracter.|
|00000cd0| 61 72 72 61 79 73 2c 20 | 75 70 70 65 72 20 63 61 |arrays, |upper ca|
|00000ce0| 73 65 20 66 6f 72 20 75 | 6e 73 69 67 6e 65 64 20 |se for u|nsigned |
|00000cf0| 76 61 72 69 61 6e 74 73 | 2c 20 61 6e 64 20 61 20 |variants|, and a |
|00000d00| 77 61 79 20 74 6f 20 73 | 70 65 63 69 66 79 20 74 |way to s|pecify t|
|00000d10| 68 65 0a 62 79 74 65 20 | 6f 72 64 65 72 2c 20 77 |he.byte |order, w|
|00000d20| 68 69 63 68 20 69 73 20 | 75 73 65 66 75 6c 20 66 |hich is |useful f|
|00000d30| 6f 72 20 5b 64 65 5d 63 | 6f 6e 73 74 72 75 63 74 |or [de]c|onstruct|
|00000d40| 69 6e 67 20 6e 65 74 77 | 6f 72 6b 20 70 61 63 6b |ing netw|ork pack|
|00000d50| 65 74 73 20 61 6e 64 0a | 72 65 61 64 69 6e 67 2f |ets and.|reading/|
|00000d60| 77 72 69 74 69 6e 67 20 | 70 6f 72 74 61 62 6c 65 |writing |portable|
|00000d70| 20 62 69 6e 61 72 79 20 | 66 69 6c 65 20 66 6f 72 | binary |file for|
|00000d80| 6d 61 74 73 20 6c 69 6b | 65 20 54 49 46 46 20 61 |mats lik|e TIFF a|
|00000d90| 6e 64 20 41 49 46 46 2e | 29 0a 0a 3c 48 52 3e 0a |nd AIFF.|)..<HR>.|
|00000da0| 0a 3c 2f 42 4f 44 59 3e | 0a 3c 2f 48 54 4d 4c 3e |.</BODY>|.</HTML>|
|00000db0| 0a | |. | |
+--------+-------------------------+-------------------------+--------+--------+