VO2740: BYTE PTR minus BYTE PTR data type?

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
kitz
Posts: 87
Joined: Wed Nov 29, 2017 8:56 am

VO2740: BYTE PTR minus BYTE PTR data type?

Post by kitz »

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

Code: Select all

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
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VO2740: BYTE PTR minus BYTE PTR data type?

Post by Chris »

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?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
kitz
Posts: 87
Joined: Wed Nov 29, 2017 8:56 am

VO2740: BYTE PTR minus BYTE PTR data type?

Post by kitz »

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
User avatar
Meinhard
Posts: 81
Joined: Thu Oct 01, 2015 4:51 pm

VO2740: BYTE PTR minus BYTE PTR data type?

Post by Meinhard »

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

Regards
Meinhard
kitz
Posts: 87
Joined: Wed Nov 29, 2017 8:56 am

VO2740: BYTE PTR minus BYTE PTR data type?

Post by kitz »

Hello Meinhard,
that worked!
Thanks, Kurt
Post Reply