BASIC Language query: How to control the Print to Screen command

Advert

BASIC Language query: How to control the Print to Screen command

Home Forums The Tea Room BASIC Language query: How to control the Print to Screen command

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37071
    Greensands
    Participant
      @greensands
      Advert
      #625319
      Greensands
      Participant
        @greensands

        I am running a Borlands Turbo BASIC program which is printing output to both the screen and to external files, the o/p consisting of a hundred or so records which means that when printing to screen, only the last 20 or so records remain visible on the screen. In DOS, paging can be controlled by adding a suffix to control output to one screen-full at a time. Can anyone suggest how this may be done within the BASIC programming structure.

        #625327
        DC31k
        Participant
          @dc31k

          Use a loop.

          Work out how many records fit on the screen. Print that many out, pause and prompt 'press any key to continue'.

          Continue until all records are printed.

          #625328
          Nick Clarke 3
          Participant
            @nickclarke3

            A quick scan through the manual does not suggest anything so perhaps some kind of loop to show 25 or so records that then pauses and waits for an INKEY$ before giving the next batch???

            Quick and dirty – if you only expect a hundred or so records repeat your loop 5 or 6 times needing an extra INKEY$ or two before the program continues?

            Or more elegantly check for a null output to exit the loop.

            #625330
            SillyOldDuffer
            Moderator
              @sillyoldduffer

              Inside BASIC the code has to keep a count of lines and wait for input every time 'n' lines have been output. The modulus operator is convenient for this. It returns the remainder of an integer division so 12 MOD 5 = 2, and 12 MOD 6 = 0.

              Thus something like:

              IF LineCount MOD 25 == 0 THEN INPUT "Return to continue", A

              PRINT(Line)

              Every 25th line, the program pauses until the operator presses the Enter key.

              Alternatively, depending on the version, DOS probably supports pipe and more. The pipe symbol '|' connects the output of one program to the input of other. 'more' is a DOS pagination program. Try:

              c:>myprogram.exe | more

              Dave

              #625334
              Greensands
              Participant
                @greensands

                Have not got a print Loop set up and working. Problem solved. Thanks for all the help provided

              Viewing 6 posts - 1 through 6 (of 6 total)
              • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

              Advert

              Latest Replies

              Home Forums The Tea Room Topics

              Viewing 25 topics - 1 through 25 (of 25 total)
              Viewing 25 topics - 1 through 25 (of 25 total)

              View full reply list.

              Advert

              Newsletter Sign-up