Online Learning Applications for Technical English


Home
Syllabus
Assignments

Instructor



Producing Homepages

The pack function will write a list of arguments into a string according to a format string:
  pack("format string", argument list);
For example, we can pack 3 numbers into a 7-byte string using the c (char), s (short), and l (long) format letters:
  $data = pack( "c s l", 31, 4159, 265359 );

The first number in the argument list (31) is packed into 1 byte, the second (4159) into 2 bytes, and the third (265359) into 4 bytes. The seven bytes (1+2+4) are joined into one string and placed in $data.

[ Back ]