Greensands | 18/12/2022 10:52:44 |
449 forum posts 72 photos | 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. |
DC31k | 18/12/2022 11:31:16 |
1186 forum posts 11 photos | 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. |
Nick Clarke 3 | 18/12/2022 11:33:31 |
![]() 1607 forum posts 69 photos | 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. |
SillyOldDuffer | 18/12/2022 11:40:42 |
10668 forum posts 2415 photos | 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
|
Greensands | 18/12/2022 12:38:55 |
449 forum posts 72 photos | Have not got a print Loop set up and working. Problem solved. Thanks for all the help provided |
Please login to post a reply.
Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!
Sign up to our newsletter and get a free digital issue.
You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy
You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.
Click THIS LINK for full contact details.
For subscription issues please see THIS LINK.