program help
Results 1 to 3 of 3

Thread: program help

  1. #1
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407

    program help

    Alright, I've been trying to right some fake servers in java lately. I have a problem when I do something like this

    Code:
    String s = null;
    s = "hello there" + "\nhow's it going";
    when this is output the how's it going part is supposed to go onto a new line at the beginning of the line because of the \n. It does that fine when I use the linux telnet, but when I try from windows it puts it on a new line, but not at the beginning, it puts it where it would be if it were still on the line above, but one line below. Is there another tag to use that puts it at the beginning of the line no matter what? Or does someone have another solution?
    Thanks
    To see what I'm talking about using windows at the command prompt type
    telnet 24.243.64.239 25
    and you will see my problem, if you do that using linux it will look fine.

  2. #2
    AO Ancient: Team Leader
    Join Date
    Oct 2002
    Posts
    5,197
    As a WAG, (Wild Assed Guess), you are giving it a line feed without a carriage return. You need to look for the code for CR......
    Don\'t SYN us.... We\'ll SYN you.....
    \"A nation that draws too broad a difference between its scholars and its warriors will have its thinking done by cowards, and its fighting done by fools.\" - Thucydides

  3. #3
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Thanks tiger shark, I think I got it but haven't tested it yet.
    it looks to be \r.

    edit

    yup tigershark, you're a genius. I had tried a search earlier for java \n thinking it would turn up all the shortcuts. This time I did java carriage return. I also had to use it like this \n\r instead of \r\n.
    thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •