Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

VO2740: BYTE PTR minus BYTE PTR data type? 19 Nov 2021 09:49 #20464

  • kitz


  • Posts: 61
  • Hello,
    I use a BYTE PTR set to the beginning of a PSZ and another moving to the end.
    So according to the Programmers Guide of 2.7 the subtraction end pointer minus begin pointer should give the byte count-1
    I tried
    LOCAL pAnf, pEnd as BYTE PTR
    LOCAL dwLen as DWORD
    ...
    dwLen := pEnd - pAnf
    But I get errors
    converting PTR <-> DWORD: 51423
    illegal automatic conversion to DWORD: 51521
    Same happens with INT and LONGINT (similar errors of course)
    Any hints?
    BR Kurt

    Please Log in or Create an account to join the conversation.

    VO2740: BYTE PTR minus BYTE PTR data type? 19 Nov 2021 10:31 #20465

    • Chris
    • Chris's Avatar


  • Posts: 2860
  • Hi Kurt,

    You can use

    dwLen := (DWORD)pEnd - (DWORD)pAnf

    but usually there's a better way of doing things in .Net than using pointers. What does the code do?
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VO2740: BYTE PTR minus BYTE PTR data type? 19 Nov 2021 10:46 #20466

    • kitz


  • Posts: 61
  • Chris,
    unfortunately that doesn't work:
    bad statement syntax: 51402
    This is in VO 2740, so no .net

    I have strings with mixed ( !! ) Windows1252 and UTF-8 character set and try to distinguish ANSII >127 and valid UTF-8 codes to be able to partially convert UTF-8 to Windows1252 to have all on the same character set. Cleaning up mess...
    I scan the PSZ-String using dereferenced pointers byte per byte.
    BR Kurt

    Please Log in or Create an account to join the conversation.

    VO2740: BYTE PTR minus BYTE PTR data type? 19 Nov 2021 10:59 #20467

    • Meinhard
    • Meinhard's Avatar


  • Posts: 64
  • Try
    dwLen :=DWORD(_CAST, pEnd - pAnf)

    Regards
    Meinhard

    Please Log in or Create an account to join the conversation.

    VO2740: BYTE PTR minus BYTE PTR data type? 19 Nov 2021 18:14 #20470

    • kitz


  • Posts: 61
  • Hello Meinhard,
    that worked!
    Thanks, Kurt

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1