Page 1 of 1 1
Topic Options
#140119 - 2005-05-22 08:12 PM kixtart reports vartype char as byte
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
think that's a booboo... wrong I mean.
_________________________
!

download KiXnet

Top
#140120 - 2005-05-22 08:25 PM Re: kixtart reports vartype char as byte
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Would you please elaborate on this a bit. Maybe some sample code.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140121 - 2005-05-23 09:41 AM Re: kixtart reports vartype char as byte
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is no universal sample code as kixtart does not produce the vartype on it's own.
like many others, kixtart does not.
so, you just have to trust on my word on this
at least vartypes 16,17 and 18 are reported as byte by kix.
_________________________
!

download KiXnet

Top
#140122 - 2005-05-23 10:09 AM Re: kixtart reports vartype char as byte
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

there is no universal sample code as kixtart does not produce the vartype on it's own.




Can you identify an object which has properties of this type? Then we could check what KiXtart reports them as.

As far as the byte/char thing goes, these are conventionally exactly the same data type, and are interchangable in many languages so I wouldn't get too hung up on KiXtart reporting chars as bytes. A similar thing applies to i/o buffers which will be byte arrays rather than strings.

Top
#140123 - 2005-05-23 03:37 PM Re: kixtart reports vartype char as byte
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
didn't get hung.
just mentioned it.
_________________________
!

download KiXnet

Top
#140124 - 2005-05-24 12:46 AM Re: kixtart reports vartype char as byte
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Jooel:

You might need to supply Ruud with your binary R/W DLL for Kixtart if you want him to figure out what's happening.
_________________________
There are two types of vessels, submarines and targets.

Top
#140125 - 2005-05-24 01:16 AM Re: kixtart reports vartype char as byte
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...or I could lend him my Carnac hat. Doesn't work for me since Johnny died anyway.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140126 - 2005-05-25 02:35 PM Re: kixtart reports vartype char as byte
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, I think ruud knows very well what this is about.
it's up to him to decide though if this is worth concerning about.

the question is, should the vartype names match the type also on the types kixtart does not create on it's own.
like, kixtart reports 8-byte real as double and 4-byte real as single.
kixtart does not create single's and still it "recognizes" it.
good. but character type is reported as byte and handled as such.
_________________________
!

download KiXnet

Top
#140127 - 2005-05-25 02:48 PM Re: kixtart reports vartype char as byte
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

but character type is reported as byte and handled as such




What's the difference?

Top
#140128 - 2005-05-25 03:26 PM Re: kixtart reports vartype char as byte
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
the difference?
if I wanna read character from a stream... say 'E'
I expect it to be 'E' but instead, it's byte of value 69 and thus kixtart translates it to long instead of more suitable string.

thats the simplest difference.
_________________________
!

download KiXnet

Top
#140129 - 2005-05-25 03:45 PM Re: kixtart reports vartype char as byte
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
But it isn't a string. That's the point. It's a char. A char is not a one character string, it is a single element of a fundamental data type.

You cannot represent a char as a string variant. The proper value of a char is the numeric value that you are seeing returned. If you consider how you'd handle char 0 you will see why this is the case. Of course you could say a null string is a char 0. But hang on, what happens when you read 6 chars which are the the zero terminated strings "a", "b" and "c"? Your string representation will only have the first string.

That is why I asked what the difference is. A byte and a char are exactly the same, and the value you are getting back is correct.

Top
#140130 - 2005-05-26 03:56 PM Re: kixtart reports vartype char as byte
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nope.
that might be the case if documentation said char is byte and kixtart ignores that vartype, but as it does not say so, it should properly say what vartype it is.
no matter how fundamentally you would thing that it's only a byte.
then I could say string is list of bytes and thus should also return just a number.

but no, strings are not just null terminated byte lists.
the strings you see in kixtart actually do carry also the length information along with them and thus can carry null character inside them.
well, might be that kixtart itself is not coded that wise but it's com-interface surely works like that.

back to the start, even though the stuff is just bytes, so it's with each vartype.
it does not remove the fact they all are DIFFERENT vartypes.
no matter how long you repeat them being bytes, they are more than that.
_________________________
!

download KiXnet

Top
#140131 - 2005-06-05 01:33 PM Re: kixtart reports vartype char as byte
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Fair enough, in the COM automation context, 'CHARs' are signed 1 byte integers and 'BYTEs' are unsigned 1 byte integers and VarTypeName should reflect the difference.

Note that to KiXtart itself, chars and bytes are identical.

Anyway, I fixed VarTypeName in the final build.

Ruud

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 978 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.063 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.