No announcement yet.

concatenating strings...

  • Filter
  • Time
  • Show
Clear All
new posts

  • concatenating strings...

    I have a weird issue.
    Perhaps it's simply because the TCP/IP Stack is returning $CRLF in my string.
    I call for the username (My app is an FTP server, rfc compliant etc)...
    g_IncomingUser is then filled with say "tngbbs"

    So I say:
    buffer = "331 password required for " + g_InComingUser
    And this is required otherwise, a $CRLF is appended on g_IncomingUser:

    buffer = Remove$(buffer,Chr$(13))
    buffer = Remove$(buffer,Chr$(10))
    Tcp Print gSock(i),buffer

    Am I to assume this is because the FTP client appended it and I have to strip it off? I suspect so...


    mailto:[email protected][email protected]</A>
    Scott Turchin
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    I haven't used the TCP/IP functions very much, but it seems pretty clear that if you do this...

    buffer = "331 password required for " + g_InComingUser
    ...and you end up with a string that ends in CR/LF, then the g_InComingUser variable (or function) must be the source of the CR/LF. I can't imagine that PB would ever, under any circumstances, add extra characters as part of a string-concatenation operation. Is that what you're asking?

    -- Eric

    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    "Not my circus, not my monkeys."


    • #3
      Scott --
      Such statements as Tcp Recv #f, kBuffer, Buffer$ brings CR/LF (it's a part of server reply)
      But instead of Remove you can simply add semicolon after TCP PRINT



      • #4

        while not directly related to your problem, you can remove$ more than one character in one go:

        <font face="courier new, courier" size="3"><pre>buffer = remove$(buffer,chr$(13, 10))[/CODE]


        <font face="courier new, courier" size="3"><pre>buffer = remove$(buffer,$crlf)[/CODE]

        will both do the same job as your two lines. not really important in this context, but if you're removing a lot of characters it's a lot easier. finally, using

        <font face="courier new, courier" size="3"><pre>buffer = remove$(buffer, any $cr & $lf)[/CODE]

        will remove any cr and lf characters, whether they're together as a pair or by themselves.

        the equates i've used are built-in but "undocumented" - they're not part of the docs, but listed in the faq forum ( ).