len() reads wrong count

Previous topic - Next topic

uwe_gl

Hello,
I use the len() function with  a variable is filled with the SOCK_RECV Command. len() tells me that the String has 45 Chars. But the String has 220 Chars. In the String are more Chars with an value less then 30.

Hallo,
Die Len() Funktion gibt eine falsche Zeichenanzahl zurück bei einen mit SOCK_RECV Empfangenen String der ASC-Zeichen kleiner 30 enthält.

Qedo

#1
It works for me
Try all the combinations
ciao

(modified)
// Project: len
// Start: Monday, April 24, 2017
// IDE Version: 14.497
a$=""
count=220
FOR k=1 TO 20000
   FOR i=1 TO count
      a$=a$+CHR$(RND(255))
   NEXT
   IF LEN (a$)<>count
      PRINT "error  " + LEN (a$),0,100
      SHOWSCREEN
      MOUSEWAIT
   ENDIF
   a$=""
NEXT
PRINT "OK",0,100
SHOWSCREEN
SLEEP 1000

Ian Price

Can you post the string here? If it is a bug, then having the actual string can help solve it easier?

Maybe certain chars are not counted? Dunno. More info from you will help identify the problem.
I came. I saw. I played.

uwe_gl

Ok, i solved the problem.
The error was by my.  :nw:
I changed the programm for output the string to file. Suddenly the value of len() was ok. It was an error by printing the value.
Thanks to all.
Greatings Uwe

Ian Price

Jobs a good'un. :D

Human input is generally the biggest bug in coding! :P
I came. I saw. I played.