struct data{
char id2;
int secs;
int version;
char misc10;
char data9999;
};
How do you convert this to Perl? I'm pretty sure it has something to do with the pack() command, but I'm not exactly sure how. The problems I am having are:
a. let's say secs=65. I need it to output 0x0041 or \#0065 as opposed to print out "65" ascii. In other words I need it to be binary and fill up 2 bytes.
b. how do you load and establish a 10,000 byte array, or create a 10,000 byte array filled with binary 0's as opposed to ascii 0's to write input and output.
I know about the chr(), ord() commands, but is there an easy way to just establish or read this type of structure?
thanks in advance.
-Greg In reply to Converting a C structure to Perl by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |