L
Larry
Hi,
is there any pack function in C++ like that one in Perl?
I need to serialize a Key and a Value in one single string, something like:
KEY1....VALUE
Where KEY1 is 4 bytes long (fixed long)
..... is an unsigned long (32-bit) rappresenting the lenght of VALUE
VALUE is the rwa data
the following is how I'd go about doing it in Perl:
my $key = 'KEY1';
my $value = "Hello World!";
my $value_len = length $value;
my $res = $key . pack("N", $value_len) . $value;
can it actually be done in C++ the same way?
thanks
is there any pack function in C++ like that one in Perl?
I need to serialize a Key and a Value in one single string, something like:
KEY1....VALUE
Where KEY1 is 4 bytes long (fixed long)
..... is an unsigned long (32-bit) rappresenting the lenght of VALUE
VALUE is the rwa data
the following is how I'd go about doing it in Perl:
my $key = 'KEY1';
my $value = "Hello World!";
my $value_len = length $value;
my $res = $key . pack("N", $value_len) . $value;
can it actually be done in C++ the same way?
thanks