Hi all,
since in PB >= 5.51 there is not possible to manage string variables as extended ascii format; what is the meaning of the function PeekS() used with the #PB_Ascii flag ?
PeekS() with #PB_Ascii flag in >=PB5.51
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
PeekS() with #PB_Ascii flag in >=PB5.51
Last edited by Psychophanta on Tue May 23, 2017 2:07 am, edited 1 time in total.
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: PeekS() with @PB_Ascii flag in >=PB5.51
We need this to scan memory that contains Ascii text, even though it is returned into a PB unicode string.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: PeekS() with #PB_Ascii flag in >=PB5.51
Aha, that's it, and how do you scan a thing if the function does not say that it matches an ascii sequence?
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: PeekS() with #PB_Ascii flag in >=PB5.51
You can try reading the memory by using different string formats, and the string format that not results in garbage, is the right string format. Sure, this way is very bad.Psychophanta wrote:how do you scan a thing if the function does not say that it matches an ascii sequence?
The only right way is that the developer of the function documents the string format, that the function returns.
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Re: PeekS() with #PB_Ascii flag in >=PB5.51
Ascii strings have never zero bytes inside
Ascii chars inside a Unicode strings have ever double zero pairs inside, for each character a pair
A PB based Ascii string ends with a zero byte
A PB based Unicode string ends with two zero bytes
This zero bytes are the string termination
Fixed strings (with a defined length) have not a termination
Saved text should have ever a BOM - Looking therefore in the Wikipedia and the PB Doku
Looking also for UTF-8
Ascii chars inside a Unicode strings have ever double zero pairs inside, for each character a pair
A PB based Ascii string ends with a zero byte
A PB based Unicode string ends with two zero bytes
This zero bytes are the string termination
Fixed strings (with a defined length) have not a termination
Saved text should have ever a BOM - Looking therefore in the Wikipedia and the PB Doku
Looking also for UTF-8