what are the codes for CR and LF?

Discussion in 'Questions (Windows Mobile)' started by Stellaferox, Jun 2, 2007.

  1. Stellaferox

    Stellaferox Active Member Licensed User

    Hi,

    I want to know the codes for CR and LF or CRLF. I am writing a subroutine in which a string is truncated after a pair of numbers separated by a CRLF (which takes 2 places in the string).
    The datastring = "1,0" & CRLF & "2,0" & CRLF & "3,0" & CRLF & "4,0" & CRLF & "5,1" & CRLF & "6,0" & CRLF & "7,1" & CRLF & "8,0" & CRLF & "9,1" & CRLF & "10,1" & CRLF
    But after reading the pair "5,1" the subroutine doesn't recognize the CRLF anymore. This is due to the 1 after the 5 (I changed this to try out).

    the subroutine is
    s = 0 '// set STOPsign
    k = 0
    dd = 0
    DO WHILE (k < StrLength(D$)-1) AND (s=0)
    T$ = StrAt(D$,k)
    IF T$ = cCRLF then
    dd = k
    s = 1
    END IF
    k=k+1 'remember there is always an increment after the stopsign
    LOOP

    Any ideas?
    thnx
    Marc
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I'm not sure I've understood your problem but crlf = Chr(13) & Chr(10)

    BTW, there is no need to use the $ sign for string variables.
     
  3. Stellaferox

    Stellaferox Active Member Licensed User

    Erel,
    Thnx, I know about the $ sign but I am tranlsating old code here and it kind of sticks on my mind..... :D
    Still don't know why the subroutine errors though...
    Marc
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Are you using version 5.00?
    You should see an error on this line:
    IF T$ = cCRLF then..
    As you've misspelled the constant crlf.
     
  5. Stellaferox

    Stellaferox Active Member Licensed User

    Yes I am using 5.00. Which Error did I make? I got no signal....
     
  6. Stellaferox

    Stellaferox Active Member Licensed User

    Because CRLF doesn't work with the string and cCRLF does.....
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    cCRLF is not a constant. It is probably a variable you are using somewhere else.
    Are you using the Check unassigned variables option?
     
  8. Stellaferox

    Stellaferox Active Member Licensed User

    Hi Erel, No I am not using it elsewhere and I always uncheck the unassigned variables because it is a bit annoying when translating from other code.
    But I got it working using CHR(13) and not the CRLF constant....
    thnx
    Marc
     
Loading...