Monday, July 27, 2009

How to add page break in my source code of Turbo C program?

My output is too large ,thats the way its supposed to be.The problem is that half of the output is at the top of the page and I just cant scroll my way up to it.Meaning I cant view the output placed at the top.My teacher asked me to add page break.Don't know how to add it.

How to add page break in my source code of Turbo C program?
If this is Turbo C for DOS, pipe output to a file, then load the file into Notepad and print it with notepad.





To pipe output to a file, use the %26gt; sign. For example:





Say your program is foo.exe, type in at DOS prompt





FOO %26gt; FOOOUT.TXT





Then load FOOOUT.TXT in notepad and print it there.
Reply:I'm not sure what you mean here. Oh well, I'll tackle both possibilities.....





If you're outputting to the monitor and everything is scrolling too quickly to see the output, you can just add a line of code to add a pause after a certain number of lines has been written to the screen. You need a variable to keep track of how many lines have been outputted and then execute something like this:





/* kbhit() requires the conio.h header file */


while (!kbhit()) /* wait for keypress */





If you're outputting to a printer, you need a variable to keep track of the number of lines outputted, and then print the ASCII character for a page break (12 decimal, or 0c hex), like this:





printf("\x0c");


No comments:

Post a Comment