Harbour Reference Guide

Bin2U()Source code  |  | Improve this doc

Convert unsigned long encoded bytes into Harbour numeric
Syntax
Bin2U( <cBuffer> ) → nNumber
Arguments
cBuffer is a character string that contains 32-bit encoded unsigned long integer (least significant byte first). The first four bytes are taken into account, the rest if any are ignored.
Returns
Bin2U() return numeric integer (or 0 if cBuffer is not a string).
Description

Bin2U() is one of the low-level binary conversion functions, those functions convert between Harbour numeric and a character representation of numeric value. Bin2U() take four bytes of encoded 32-bit unsigned long 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).

Bin2U() is the opposite of U2Bin()

Examples
// Show number of records in DBF
#include "fileio.ch"
LOCAL hFile, cBuffer := Space( 4 )
IF ( hFile := hb_vfOpen( "test.dbf", FO_READ ) ) != NIL
   hb_vfSeek( hFile, 4 )
   hb_vfRead( hFile, @cBuffer, hb_BLen( cBuffer ) )
   ? "Number of records in file:", Bin2U( cBuffer )
   hb_vfClose( hFile )
ELSE
   ? "Cannot open file"
ENDIF
Status
Ready
Compliance
XPP
Platforms
Available on all platforms
File
Library is core
Tags
API, Conversion
See also

U2Bin()Source code  |  | Improve this doc

Convert Harbour numeric into unsigned long encoded bytes
Syntax
U2Bin( <nNumber> ) → cBuffer
Arguments
nNumber is a numeric value to convert (decimal digits are ignored).
Returns
U2Bin() return four bytes character string that contains 32-bit encoded unsigned long integer (least significant byte first).
Description

U2Bin() is one of the low-level binary conversion functions, those functions convert between Harbour numeric and a character representation of numeric value. U2Bin() take a numeric integer value and convert it into four bytes of encoded 32-bit unsigned long integer.

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).

U2Bin() is the opposite of Bin2U()

Status
Ready
Compliance
XPP
Platforms
Available on all platforms
File
Library is core
Tags
API, Conversion
See also

W2Bin()Source code  |  | Improve this doc

Convert Harbour numeric into unsigned short encoded bytes
Syntax
W2Bin( <nNumber> ) → cBuffer
Arguments
nNumber is a numeric value to convert (decimal digits are ignored).
Returns
W2Bin() return two bytes character string that contains 16-bit encoded unsigned short integer (least significant byte first).
Description

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

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).

W2Bin() is the opposite of Bin2W()

Status
Ready
Compliance
XPP
Platforms
Available on all platforms
File
Library is core
Tags
API, Conversion
See also

dbSkipper()  |  | Improve this doc

Helper function to skip a database
Syntax
dbSkipper( <nRecs> ) → nSkipped
Arguments
nRecs is the number of records to skip relative to current record. Positive number would try to move the record pointer forward, while a negative number would try to move the record pointer back nRecs records.
Returns
dbSkipper() return the number of actual record skipped.
Description
dbSkipper() is a helper function used in browse mechanism to skip a number of records while giving the caller indication about the actual records skipped.
Examples
// open a file and find if we've got enough records in it
USE test
IF dbSkipper( 100 ) == 100
   ? "Good work! You can party now"
ELSE
   ? "Too bad, you should really work harder"
ENDIF
Status
Ready
Compliance
XPP
Platforms
Available on all platforms
File
Library is core
Tags
API, User interface
See also