Page 1 of 1

PeekS() Question

Posted: Thu May 04, 2006 10:38 pm
by Xombie
Shouldn't PeekS() in this case...

Code: Select all

a.s = "Note:  a combination of PokeS() and PeekS() can be used..."
b.l = @a + 14
Debug "'"+Mid(a, 8, 10)+"'"
Debug "'"+PeekS(b, 10)+"'"
Return 'a com' rather than 'a combinat' ? The help file says "An optional 'Length' parameter (in bytes) can be specified." So in unicode, each character is 2 bytes, right?

Posted: Thu May 04, 2006 10:43 pm
by thefool
Debug SizeOf(character)
= 1.
:)

when you do @string + 5 (bytes..) you also get 5 chars ahead, not 2.5

Posted: Thu May 04, 2006 11:51 pm
by Xombie
I forgot to mention "when compiled with /UNICODE". That should force the .c to be two bytes.

Posted: Fri May 05, 2006 7:58 am
by ABBKlaus
I guess the helpfile is wrong it should say 'chars' :!:

Posted: Fri May 05, 2006 10:16 am
by Fred
True, it should be characters, i will update the doc. Your code should look like this to be unicode compliant:

Code: Select all

a.s = "Note:  a combination of PokeS() and PeekS() can be used..."
b.l = @a + 7*SizeOf(Character)
Debug "'"+Mid(a, 8, 10)+"'"
Debug "'"+PeekS(b, 10)+"'"

Posted: Fri May 05, 2006 1:27 pm
by Nik
I don't think it's a good idea to have lengt parameters for memory functions in chars instead of in bytes though one can also use copymemory.

Posted: Fri May 05, 2006 1:55 pm
by Fred
PeekS() read a string, i don't see why we should should allow to pick an 'half' character in unicode, it's no sens IMHO.

Posted: Fri May 05, 2006 3:12 pm
by josku_x
And, even if we could pick half characters, for what are they good? I have not seen a program that uses a half A: Image :wink:

Posted: Fri May 05, 2006 4:25 pm
by Nik
yeah ok you are probably right

Posted: Fri May 05, 2006 5:27 pm
by Trond
josku_x wrote:And, even if we could pick half characters, for what are they good? I have not seen a program that uses a half A: Image :wink:
I've seen one that uses a lot of half letters. They call it AbiWord.

Posted: Fri May 05, 2006 8:28 pm
by josku_x
Ok, I'll look for that.