Get the location of the first special console character in a buffer.
XSharp.RT (in XSharp.RT.dll) Version: 2.2a
Syntax View Source
ptrBuffer AS IntPtr,
dwCount AS DWORD
) AS DWORD
public static uint MemAtSpecial(
- Type: IntPtr
A pointer to a buffer.
- Type: UInt32
The number of bytes in <ptrBuffer> to check.
The location of the first special console character within the specified portion of <ptrBuffer>. If a special console character does not exist, MemAtSpecial() returns 0.
Special console characters are characters with ASCII values less than or equal to 13, which can require special handling when displayed on the screen. Moreover, a terminal driver can assign special meaning to them, such as ringing the bell when a Chr(7) is specified.
This example uses MemAtSpecial() iteratively to detect all special console characters in a string:
LOCAL s := "AB" + _Chr(10) + "CD" + _Chr(7) + ;
"EF" + _Chr(13) + "GH" AS STRING
LOCAL wAt AS DWORD
DO WHILE SLen(s) > 0
wAt := MemAtSpecial(Ptr(_CAST, s), SLen(s))
IF wAt > 0
? "Special char with ASCII code of:",;
Asc(Substr3(s, wAt, 1)), "was detected"
// Query the rest of the string
// (from wAt+1 and on)
s := Substr(s, wAt+1)
s := ""