zulkan's blog

By zulkan, 11 years ago, In English

I have this code http://ideone.com/aAhXE8

but in cf (custom test) it has different output http://s16.postimg.org/hug6l6y4l/bug.jpg

why is the newline character still entering the loop ?

in my computer the output is like the one in ideone, is it a bug in CF ?

edit : answered, CF is using : ~~~~~ "\r\n" ~~~~~

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
11 years ago, # |
  Vote: I like it +8 Vote: I do not like it

I think, it's better to write like this while ((c = (char)br.read()) && c >= '0' && c <= '9') (Sorry for my poor english)

  • »
    »
    11 years ago, # ^ |
      Vote: I like it -6 Vote: I do not like it

    maybe you meant while ( (c=(char)br.read())>='0' && c <='9)

    because (c = (char)br.read()) isn't a condition, but, now i know that for new line, CF use "\r\n"

»
11 years ago, # |
  Vote: I like it +26 Vote: I do not like it

You can fix it if you add && c != '\r' into if condition. It happend because of difference between newline representation by Linux and Windows. http://en.wikipedia.org/wiki/Newline#Representations