MemAtSpecial Function | |
Get the location of the first special console character in a buffer.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION MemAtSpecial(
ptrBuffer AS IntPtr,
dwCount AS DWORD
) AS DWORD
public static uint MemAtSpecial(
IntPtr ptrBuffer,
uint dwCount
)
Request Example
View SourceParameters
- ptrBuffer
- Type: IntPtr
A pointer to a buffer. - dwCount
- Type: DWord
The number of bytes in ptrBuffer to check.
Return Value
Type:
DWord
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.
Remarks
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.
Examples
This example uses MemAtSpecial() iteratively to detect all special console characters in a string:
1FUNCTION Start()
2 LOCAL s := "AB" + _Chr(10) + "CD" + _Chr(7) + ;
3 "EF" + _Chr(13) + "GH" AS STRING
4 LOCAL wAt AS DWORD
5 DO WHILE SLen(s) > 0
6 wAt := MemAtSpecial(Ptr(_CAST, s), SLen(s))
7 IF wAt > 0
8 ? "Special char with ASCII code of:",;
9 Asc(Substr3(s, wAt, 1)), "was detected"
10
11
12 s := Substr(s, wAt+1)
13 ELSE
14 s := ""
15 ENDIF
16 ENDDO
See Also