Announcement

Collapse
No announcement yet.

$crlf

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $crlf

    PRINT "Bob" & $CRLF & "Tom"

    Why in the above code doesn't $CRLF produce a carriage return and line feed?
    All I see are a couple of funny looking characters on the console.
    Regards,
    Bob

  • #2
    Those funny looking characters are the CHR$ representation of CR and LF.

    I can't remember the exact whys-n-what-fers but PB has pretty much always been this way.

    The fix is that you are going to have to write a parsing routine to extract each string you want to print, deleting the Cr/Lf from the print string.

    This subject has been brought up before but I can't find a reference to them.
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      Hey Robert,

      You could also replace PRINT with STDOUT.
      Start as you mean to go on.

      Comment


      • #4
        If you use STDOUT it works as you expected.

        From the PBCC help file under PRINT:
        Any control codes such as Carriage Return, Line-Feed and Backspace are not interpreted by PRINT and will display on the screen as symbols in the current selected font.
        edit: Mark beat me by 2 minutes.
        Last edited by Greg Lyon; 15 Jan 2008, 12:49 AM. Reason: cross-post

        Comment


        • #5
          Thank you all very much.
          Regards,
          Bob

          Comment


          • #6
            Originally posted by Robert DeBolt View Post
            PRINT "Bob" & $CRLF & "Tom"
            Why in the above code doesn't $CRLF produce a carriage return and line feed?
            All I see are a couple of funny looking characters on the console.
            Actually, the real question is "Why should it produce a...?". Windows Fonts typically define a graphic character for each CHR$(10) and CHR$(13). If PowerBASIC were to arbitrarily interpret these 2 bytes for another purpose, you'd never be able to display these graphic characters. It would simply be impossible. There are two choices available here, and we chose the one which allows the maximum flexibility.

            PowerBASIC uses PRINT without an argument to move the print position to the first character on the next line. This has been a standard of BASIC for 30 years or more?

            Best regards,

            Bob Zale
            PowerBASIC Inc.

            Comment


            • #7
              more ... would you believe 43 years ...

              Dartmouth BASIC first public release version June, 1964. Second version enhanced the PRINT command with semi-colon.

              However on May 1, 1964 at 4 am, John Kemeny and John McGeachie ran the first BASIC programs to be executed successfully from terminals by the DTSS system. It is not completely clear what the first programs were. However the programs either consisted of the single line: PRINT 2 + 2
              or were implementations of the Sieve of Eratosthenes according to a 1974 interview in which Kemeny and McGeachie took part.
              http://en.wikipedia.org/wiki/Dartmou...st_of_commands
              Rick Angell

              Comment


              • #8
                >>>...If PowerBASIC were to arbitrarily interpret these 2 bytes ...<<<

                Well Bob, PB/DOS 3.5 gives the user an option of turning "Intreperted print" on/off. Why not have this option in PB/CC?

                Maybe a wish list item?
                There are no atheists in a fox hole or the morning of a math test.
                If my flag offends you, I'll help you pack.

                Comment


                • #9
                  Originally posted by Mel Bishop View Post
                  >>>...If PowerBASIC were to arbitrarily interpret these 2 bytes ...<<<

                  Well Bob, PB/DOS 3.5 gives the user an option of turning "Intreperted print" on/off. Why not have this option in PB/CC?
                  Because you've got STDOut, which wasn't available in PB/DOS and does what the OP requested?

                  Comment

                  Working...
                  X