1

I'm using GW-BASIC language and I need the output to be printed at the center of the page, right now it starts from the top left of the A4 size page, can I tried to set the margin using printer preference but there is no such option.

Can anyone tell me how to set it to print to the center of the page?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
MZH
  • 1,414
  • 4
  • 29
  • 57

1 Answers1

1

No way for me to be sure what the x and y need to be for your specific message on an A4 sized paper, but using the LOCATE statement to move the cursor would be the easiest way.

Likely take trial and error to get your message to be perfectly centered on your particular display.

Quick Google got me this : GW-BASIC User's Guide - LOCATE Statement

From the site:

Syntax:

LOCATE [row][,[col][,[cursor][,[start] [,stop]]]]

Comments:

row is the screen line number, a numeric expression within the range of 1 to 25.

col is the screen column number, a numeric expression within the range of 1 to 40, or 1 to 80, depending upon screen width.

cursor is a Boolean value indicating whether the cursor is visible; zero is off, nonzero is on.

start is the cursor start scan line, a numeric expression within the range of 0 to 31.

stop is the cursor stop scan line, a numeric expression within the range of 0 to 31.

Only the first two arguments are really necessary for a simple movement of the cursor, something like:

10 LOCATE 4,20
20 PRINT "YOUR TITLE HERE"

The above would move the cursor to the 4th row and 20th column then print "YOUR TITLE HERE".

0x90h
  • 738
  • 5
  • 11
  • Yeah. I know it is over a month old, but I figured it might help if anyone came back looking... – 0x90h May 07 '13 at 09:05
  • It would be useful if you added the relevant code to your answer. That way, if the link stops working, your answer may still help future visitors. – Ren May 07 '13 at 09:21