Oh, I almost missed that little part at the end with the sprintf...
DWORD generated_check=(rand()<<16) | rand(); char gcheck[64]; sprintf(gcheck, "%x", generated_check);
My C, as I said, is marginal, but if this is doing what I think it's doing, ...
$gcheck = printf "%x", ((rand() << 16) | rand());
I'm assuming here that the C << operator is a left shift just like in Perl, but that's a wild guess. I'm also assuming that rand with no args in C does the same thing as in Perl, which is also a guess. Like I said, my knowledge of C leaves something to be desired. I know what the Perl code does. (It prints "0" every time.) I'm guessing at the C code. Probably guessing wrong.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
In reply to Re: A little C code converted to Perl *HELP*
by jonadab
in thread A little C code converted to Perl *HELP*
by regnab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |