PeekS() Question

Everything else that doesn't fall into one of the other PB categories.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

PeekS() Question

Post 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?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Debug SizeOf(character)
= 1.
:)

when you do @string + 5 (bytes..) you also get 5 chars ahead, not 2.5
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

I forgot to mention "when compiled with /UNICODE". That should force the .c to be two bytes.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

I guess the helpfile is wrong it should say 'chars' :!:
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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)+"'"
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post 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.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post 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:
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

yeah ok you are probably right
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Ok, I'll look for that.
Post Reply