Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

BITON()

BitOn( <cString>, <nInitialBit>, <nCountBits>, <nStringSize> )

Records the partial string-bit activation contract.

BITON()AdvPL
01 · OVERVIEW

Overview

The BITON() page describes setting bits in a string through four arguments: string, initial bit, bit count and string size. This is not a numeric BitOn(nNumber,nBit) signature. The page does not clarify index base, return representation or invalid-bound behavior. This review therefore provides no expected binary result and does not recommend use for real permission fields or formats. The example isolates a diagnostic call on a fictional byte and records only the returned type, subject to testing. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

BitOn( <cString>, <nInitialBit>, <nCountBits>, <nStringSize> )

Parameters

cString
CharacterRequired

Bit string.

nInitialBit
NumericRequired

Initial bit; base unspecified.

nCountBits
NumericRequired

Bit count.

nStringSize
NumericRequired

String size.

Return value

Unspecified in the page; verify type and content in testing.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function EdBiton()
    Local cTest := Chr(0)
    Local xReturn
    // Isolated diagnostic; not a production format.
    xReturn := BitOn(cTest, 1, 1, Len(cTest))
    ConOut(ValType(xReturn))
Return Nil
Expected result

Return type to be verified; no binary value is assumed. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Record build, hexadecimal input and output in isolated tests before extending semantics. Do not substitute a similarly named numeric API.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. BITON(). TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha