A
A. Farber
Hello,
I'm using perl 5.8.8 and gcc 3.3.5 of OpenBSD 4.3/i386
to unpack a C-structure received over a unix pipe
(where event_type is enum and SID_LEN is 32):
typedef struct request_header {
char sid[SID_LEN + 1];
event_type event;
time_t modified;
uint32_t arg;
} request_header;
I try to unpack it this way:
($self->{SID}, $self->{EVENT},
$self->{MOD}, $self->{ARG}) =
unpack 'A32x4L3', $self->{REQUEST};
It mostly works well, but for the ARG 0x80000000
I wrongly get 0x7FFFFFFF (which is same but negated?)
Could someone please advise me?
This signed/unsigned binary stuff is so confusing :-(
I tried to read perlpacktut several times, never got it 100%.
Thank you
Alex
I'm using perl 5.8.8 and gcc 3.3.5 of OpenBSD 4.3/i386
to unpack a C-structure received over a unix pipe
(where event_type is enum and SID_LEN is 32):
typedef struct request_header {
char sid[SID_LEN + 1];
event_type event;
time_t modified;
uint32_t arg;
} request_header;
I try to unpack it this way:
($self->{SID}, $self->{EVENT},
$self->{MOD}, $self->{ARG}) =
unpack 'A32x4L3', $self->{REQUEST};
It mostly works well, but for the ARG 0x80000000
I wrongly get 0x7FFFFFFF (which is same but negated?)
Could someone please advise me?
This signed/unsigned binary stuff is so confusing :-(
I tried to read perlpacktut several times, never got it 100%.
Thank you
Alex