Harbour All Functions – B

BeforAtNum

Bin2I
Bin2L
Bin2U
Bin2W

BinToDec

BitToC

Bof

BoM

BoQ

BoY

Break

Browse

Conversion Functions

Harbour Conversion Functions

Bin2I Convert signed short encoded bytes into Harbour numeric
Bin2L Convert signed long encoded bytes into Harbour numeric
Bin2U Convert unsigned long encoded bytes into Harbour numeric
Bin2W Convert unsigned short encoded bytes into Harbour numeric
BitToC Converts position-dependent bits into characters
BinToDec Converts a Binary Value to Decimal
CToBit Converts a character string into a bit pattern
CToF Converts a special 8-byte string into a floating point number
CToN Converts a numeric string into a different base
DecToBin Converts a Decimal Value to Binary
DecToHexa Converts a Decimal Value to Hexa
DecToOctal Converts a Decimal Value to Octal
Fahrenheit Temperature conversion Celsius to Fahrenheit
FToC Converts a floating point number into a special 8-byte string
HexaToDec Converts a Hexa Value to Decimal
I2Bin Convert Harbour numeric into signed short encoded bytes
L2Bin Convert Harbour numeric into signed long encoded bytes
NToC Converts the numbers in a digit string into a different number base
OctalToDec Converts a Octal Value to Decimal
U2Bin Convert Harbour numeric into unsigned long encoded bytes
W2Bin Convert Harbour numeric into unsigned short encoded bytes
Word Converts double to integer values
XTOC Convert an expression to character type string

FReadStr()

FREADSTR()

Reads a string from a file opened with low-level access

Syntax

      FREADSTR(<nHandle>, <nBytes>) --> cString

Arguments

<nHandle> DOS file handle number.

<nBytes> Number of bytes to read.

Returns

<cString> an character expression

Description

This function returns a character string of <nBytes> bytes from a file whose DOS file handle is <nHandle>.

The value of the file handle <nHandle> is obtained from either the FOPEN() or FCREATE() functions.

The value of <nBytes> is the number of bytes to read from the file. The returned string will be the number of characters specified in <nBytes> or the number of bytes read before an end-of-file charac- ter (ASCII 26) is found.

NOTE This function is similar to the FREAD() function, except that it will not read binary characters that may he required as part of a header of a file construct. Characters Such as CHR(0) and CHR(26) may keep this function from performing its intended operation. In this event, the FREAD() function should he used in place of the FREADSTR() function.

Examples

      #include "fileio.ch"
      IF ( nH := FOpen( "x.txt" ) ) != F_ERROR
         cStr := FReadStr( nH, 100 )
         ? cStr
         FClose( nH )
      ENDIF

Compliance

Clipper

Platforms

All (64K)

Files

Library is rtl

Seealso

BIN2I(), BIN2L(), BIN2W(), FERROR(), FREAD(), FSEEK()

FRead()

FREAD()

Reads bytes from a file opened by low-level access

Syntax

      FREAD( <nHandle>, @<cBuffer>, <nBytes> ) --> nBytes

Arguments

<nHandle> Dos file handle

<cBuffer> Character expression passed by reference.

<nBytes> Number of bytes to read.

Returns

<nBytes> the number of bytes successfully read from the file. <nHandle>

Description

This function reads the characters from a file whose file handle is <nHandle> into a character memory variable expressed as <cBuffer>. The function returns the number of bytes successfully read into <cBuffer>.

The value of <nHandle> is obtained from either a call to the FOPEN() or the FCREATE() function.

The <cBuffer> expression is passed by reference and must be defined before this function is called. It also must be at least the same length as <nBytes>.

<nBytes> is the number of bytes to read, starting at the current file pointer position. If this function is successful in reading the characters from the file, the length of <cBuffer> or the number of bytes specified in <nBytes> will be the value returned. The current file pointer advances the number of bytes read with each successive read. The return value is the number of bytes successfully read from the file. If a 0 is returned, or if the number of bytes read matches neither the length of <cBuffer> nor the specified value in <nBytes> an end-of-file condition has been reached.

Examples

      #include "fileio.ch"
      cBuffer := Space( 500 )
      IF ( nH := FOpen( "x.txt" ) ) == F_ERROR
         FRead( nH, @cBuffer, 500 )
         ? cbuffer
      ENDIF
      FClose( nH )

Compliance

Clipper

Platforms

All (64K)

Files

Library is rtl

Seealso

BIN2I(), BIN2L(), BIN2W(), FERROR(), FWRITE()

W2Bin()

W2Bin()

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 contain 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()

Compliance

XPP

Files

Library is core

Seealso

Bin2I(), Bin2L(), Bin2U(), Bin2W(), I2Bin(), L2Bin(), Word(), U2Bin(), FWrite()

U2Bin()

U2Bin()

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 contain 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()

Compliance

XPP

Files

Library is core

Seealso

Bin2I(), Bin2L(), Bin2U(), Bin2W(), I2Bin(), L2Bin(), W2Bin(), Word(), FWrite()

L2Bin()

L2BIN()

Convert Harbour numeric into signed long encoded bytes

Syntax

      L2BIN( <nNumber> ) --> cBuffer

Arguments

<nNumber> is a numeric value to convert (decimal digits are ignored).

Returns

L2BIN() return four bytes character string that contain 32 bit encoded signed long integer (least significant byte first).

Description

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

L2BIN() is the opposite of BIN2L()

Compliance

Clipper

Files

Library is rtl

Seealso

BIN2I(), BIN2L(), BIN2U(), BIN2W(), I2BIN(), W2BIN(), WORD(), U2BIN(), FWRITE()