Results 1 to 4 of 4

Thread: Please help converting 2 PHP functions to vb.net (or c#)

Threaded View

  1. #1

    Thread Starter
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Question Please help converting 2 PHP functions to vb.net (or c#)

    I'm converting a php code containing the following 2 functions:

    PHP Code:
         /**
         * Covert a string into longinteger
         *
         * @param string $data
         * @return array
         */
        
    function _str2long($data)
        {
            
    $n strlen($data);
            
    $tmp unpack('N*'$data);
            
    $data_long = array();
            
    $j 0;

            foreach (
    $tmp as $value$data_long[$j++] = $value;
            return 
    $data_long;
        }

        
    /**
         * Convert a longinteger into a string
         *
         * @param int $l
         * @return string
         */
        
    function _long2str($l)
        {
            return 
    pack('N'$l);
        } 
    I am currently concerned with php pack and unpack functions. Although I've got some rough understanding about what they are doing I am a bit worried if I understand them right and I've no test data to ensure I'll make a correct implementation. Can anyone help me to convert this code or basically, what I want is to get a correctly working implementation of php pack and upack functions with this exact format ("N" and "N*") in either vb.net or c#.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width