Sorry Gernot, I don't understand what you mean. The "\0" is being added by the 'INPUT' command when you hit the enter key.
Here's some test code.
Try it as is, then swap the comment on these two lines. When the comparrison is "CHR$(0)" the \0 character isn't detected and the code thinks you've typed an invalid character, but it works if you change it to check for '\0'
These are the lines to swap the comment on
IF Char$ = CHR$(0)
// IF Char$ = "\0"
Test code
TestFunc()
FUNCTION TestFunc:
LOCAL FinalString$
LOCAL MyString$
LOCAL Char$
LOCAL Loop
PRINT "Type in a string",0,0
INPUT MyString$,0,50
FOR Loop = 0 TO LEN(MyString$)
Char$=MID$(MyString$,Loop,1)
IF Char$ = CHR$(0)
// IF Char$ = "\0"
PRINT "\\0 found",0,150
SHOWSCREEN
SLEEP 2000
RETURN 2
ELSEIF Char$ < "0" OR Char$ > "9"
PRINT "Error - illegal character " + Char$ + " found at position " + (Loop+1) + ". Only 0-9 accepted.\n",0,100
PRINT "ASC = " + ASC(Char$) + "\n",0,200
SHOWSCREEN
SLEEP 2000
RETURN 1
ELSE
FinalString$=FinalString$ + Char$
ENDIF
NEXT
PRINT "Final String = "+FinalString$,0,200
SHOWSCREEN
SLEEP 2000
ENDFUNCTION