Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Harbour Version 0.37 (c) reference Guid - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

BIN2W()

Convert unsigned short encoded bytes into Harbour numeric
---------------------------------------------------------------------------------

 Syntax

        BIN2W( <cBuffer> ) --> nNumber  

 Arguments

        <cBuffer>   is a character string that contain 16 bit encoded 
                  unsigned short integer (least significant byte first).
                  The first two bytes  are taken into account, the rest if
                  any are ignored.

 Returns

        BIN2W()   return numeric integer (or 0 if <cBuffer> is not a 
                  string).

 Description

      BIN2W() is one of the low level binary conversion functions, those
      functions convert between Harbour numeric and a character
      representation of numeric value. BIN2W() take two bytes of encoded
      16 bit unsigned short integer and convert it into standard Harbour
      numeric value.

      You might ask what is the need for such functions, well, first of
      all it allow you to read/write information from/to a binary file
      (like extracting information from DBF header), it is also a useful
      way to share information from source other than Harbour (C for
      instance).

      BIN2W() is the opposite of W2BIN()

 Examples

 
      // Show header length of a DBF
      FUNCTION main()
      LOCAL nHandle, cBuffer := space( 2 )
      nHandle := fopen( "test.dbf" )
      IF nHandle > 0
         fseek( nHandle, 8 )
         fread( nHandle, @cBuffer, 2 )
         ? "Length of DBF header in bytes:", BIN2W( cBuffer )
         fclose( nHandle )
      ELSE
         ? "Can not open file"
      ENDIF
      RETURN NIL
 

Status

      Ready

 Compliance

      BIN2W() works exactly like CA-Clipper's BIN2W()

 Files

      Library is rtl



See Also: BIN2I() BIN2L() BIN2U() I2BIN() L2BIN() W2BIN() WORD() U2BIN() FREAD()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson