in reply to ioctl into or from perl structs

Here's one way:

my $msf0_fmt = "c3x"; # x because this is likely to # be padded. omit as needed my $cdrom_addr_fmt = "$msf0_fmt I"; my $cdrom_tocentry_fmt = "c4 $cdrom_addr_fmt c"; # will need padding # if struct cdte_addr + is larger my $str = pack $cdrom_toentry_fmt; # make the string long enough # ... # call the ioctl on $str my @data = unpack $cdrom_toentry_fmt, $str;
You will probably need to adjust the formats a bit, they depend on how the data is packed by the C compiler.

There is code on Zaxo's scratchpad which may help, too. It is a translation of the Linux bit-twiddling for constructing ioctl commands. I expect it would be simple to adapt it to other platforms.

Update: Fixed an out of sequence line in the code. I've posted the scratchpad code at Linux ioctl command module.

After Compline,
Zaxo