Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!! 
Author Message
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!

OK, by now everyone should know that I am an old man, and I am trying
to get my degree in Comp Science here in Texas.

I have downloaded a bunch of the files from our text book. The files
do not have any USES statements in them at all. I have included the
USES Wincrt; line to the code, but I have not been able to get ANY of
these to print. I am using the following line in the USES section:

Uses Wincrt,print;

Then I put the lst code within a writeln statement. I copy a writeln
statement which I know already works (it shows the results on the
screen, so I know it works.....)

The program is not written by me, but by the author of our textbook.
The program runs just fine until I add the LST to the second writeln?
I do not understand what I am doing wrong?

I am doing this in an effort to find out why I cannot get anything to
print in my own program (very basic homework assignment)

I am using Borland TP for Win v1.5 on a Pentium3-500 with 256 meg of
mem etc etc etc I have the fully licensed product.

This is the entire program as it was written with the exception of the
second writeln (noted by me below)  

PROGRAM Notices (Input, Output);

(* This program determines a student?s average based on three *)
(* test scores, and the student?s passing/failing status      *)

USES Wincrt,print;

VAR
  Average:        (* Average of three test scores    *)
    Real;
  Student_ID,     (* Student's identification number *)
  Test1,          (* Score for first test            *)
  Test2,          (* Score for second test           *)
  Test3:          (* Score for third test            *)
    Integer;
  Data_OK:        (* True if data is correct         *)
    Boolean;
BEGIN (* Notices *)
  (* Get data *)
  Writeln('Enter a Student ID number and three test scores:');
  Readln(Student_ID, Test1, Test2, Test3);
  Writeln('Student Number: ', Student_ID:1, '  Test Scores: ',
           Test1:1, ', ', Test2:1, ', ', Test3:1);
  Writeln(lst,'Student Number: ', Student_ID:1, '  Test Scores: ',
           Test1:1, ', ', Test2:1, ', ', Test3:1);

**NOTE: I added this last writeln (above) and the lst code ****

  (* Test data *)
  IF (Test1 < 0) OR (Test2 < 0) OR (Test3 < 0)
    THEN
      Data_OK := False
    ELSE
      Data_OK := True;
  IF Data_OK
    THEN
      BEGIN
        (* Calculate Average *)
        Average := (Test1 + Test2 + Test3) / 3.0;
        (* Print message *)
        Write('Average score is ', Average:4:2, '--');
        IF Average >= 60.0
          THEN                             (* Student is passing *)
            BEGIN
              Write('Passing');
              IF Average < 70.0
                THEN                             (* But marginal *)
                  Writeln(' but marginal.')
                ELSE
                  Writeln('.')
            END
          ELSE                             (* Student is failing *)
            Writeln('Failing.')
      END
    ELSE                                         (* Invalid data *)
      Writeln('Invalid Data:  Score(s) less than zero.')
END.  (* Notices *)



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!
just use:

USES WinCrt;

i dont know what that print stuff is you have in your uses statement is...

also, you might want to get use to have programs ask for each piece of input on
a seperate line.

http://come.to/meckteck
http://www.kilnar.com/~northwind/



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!

Quote:

>Uses Wincrt,print;

Did not look at your whole program. In DOS versions you have CRT and
PRINTER. I know WinCrt is correct but I don't think "print" is.

Regards,
Clif



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!
Quote:

> Under windows you need to use the WinPrn unit

for printing.

I'm just learning Pascal, too, and I tried using
the WinPrn unit in a program to see what it could
do.  I did everything the way you've described:

PROGRAM testwords (WordsToDisplay, output);
USES WinCRT, WinPrn;

And I get a Compile error message, Error 15: File
not Found (WINPRN.TPU).  I'm running TPW 1.5. .
.does this version of Turbo Pascal not have the
WINPRN unit?  And, if not, where can I get it?

--
--Maximus Prime



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!



Quote:
> OK, by now everyone should know that I am an old man, and I am trying
> to get my degree in Comp Science here in Texas.

> I have downloaded a bunch of the files from our text book. The files
> do not have any USES statements in them at all. I have included the
> USES Wincrt; line to the code, but I have not been able to get ANY of
> these to print. I am using the following line in the USES section:

> Uses Wincrt,print;

> Then I put the lst code within a writeln statement. I copy a writeln
> statement which I know already works (it shows the results on the
> screen, so I know it works.....)

hi richard,

i'm not not thinking about _your_ source, but check at first, please:

is your printer (i think it's an hp 8xx ?) a "GDI"-printer (will only work
as a windoze-device, not with "LST") ??? if so, you need a unit
like "WINPRINT" (i'm not a guru, ask the specialists for windoze how
that "perfect" system works).

connect an old 9-needle-printer to your printerport and test your
compilation. if that works, you must print to your hp 8xx only with
windoze-GDI-printing-system.

and let all of us hope, that hp never forgot the PCL-printer-language !!!

good luck
--
Hourdi
alias Georg O.F. Richter



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!

Quote:
>OK, by now everyone should know that I am an old man, and I am trying
>to get my degree in Comp Science here in Texas.

>I have downloaded a bunch of the files from our text book. The files
>do not have any USES statements in them at all. I have included the
>USES Wincrt; line to the code, but I have not been able to get ANY of
>these to print. I am using the following line in the USES section:

>Uses Wincrt,print;

>Then I put the lst code within a writeln statement. I copy a writeln
>statement which I know already works (it shows the results on the
>screen, so I know it works.....)

>The program is not written by me, but by the author of our textbook.
>The program runs just fine until I add the LST to the second writeln?
>I do not understand what I am doing wrong?

Under windows you need to use the WinPrn unit for printing.

Uses WinCRT, WinPrn;

var Lst : Text;

begin
     AssignDefPrn(Lst);   {assigns Lst variable with default printer}

Now just write/writeln to Lst in the form of:

     Writeln(Lst,data);

When you have finished writing to the printer then using

     Close(Lst);

will send the whole output to the printer.

The online help has some info on WinPrn.
--
Information on Newsgroup posted weekly on Sunday - read before writing!
Contains links to    |  http://homepages.force9.net/pascal/faq/
helpful information  |  http://www.merlyn.demon.co.uk/clpb-faq.txt
and some guidelines  |  ftp://garbo.uwasa.fi/pc/doc-net/faqclpb.zip



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!
if yer using the TPW 1.5 that comes with BP7, use "bpc -cw program_name"
(from the command line) to specify the windows platform.  its unsuccessful
search for a .TPU as opposed to a .TPW file means it's trying to compile a
DOS program.


:> Under windows you need to use the WinPrn unit
: for printing.

: I'm just learning Pascal, too, and I tried using
: the WinPrn unit in a program to see what it could
: do.  I did everything the way you've described:

: PROGRAM testwords (WordsToDisplay, output);
: USES WinCRT, WinPrn;

: And I get a Compile error message, Error 15: File
: not Found (WINPRN.TPU).  I'm running TPW 1.5. .
: .does this version of Turbo Pascal not have the
: WINPRN unit?  And, if not, where can I get it?

: --
: --Maximus Prime



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!


Quote:
>Uses Wincrt,print;

>Then I put the lst code within a writeln statement. I copy a writeln
>statement which I know already works (it shows the results on the
>screen, so I know it works.....)

>The program is not written by me, but by the author of our textbook.
>The program runs just fine until I add the LST to the second writeln?
>I do not understand what I am doing wrong?

In all TP versions I've ever used, the unit was named "printer", not
"print". Perhaps this is a typo in your book? Perhaps there are two
versions of the unit differently named and yours is "printer"?

After that, LST behaves like a file (already open for output) and so you
can just writeln(LST,'whatever');

Works for me! Good luck...

One more thing - some printers (e.g. Lasers) don't throw the page until
you say so. I always include a write(LST,#12) at the end, just to make
sure. That's the Form-Feed character by the way!

--

http://www.ntos.demon.co.uk



Wed, 18 Jun 1902 08:00:00 GMT  
 Me Aagin. I am having a heck of a time trying to get anything to print. HELP!!!


Quote:
>OK, by now everyone should know that I am an old man, and I am trying
>to get my degree in Comp Science here in Texas.

>I have downloaded a bunch of the files from our text book. The files
>do not have any USES statements in them at all. I have included the
>USES Wincrt; line to the code, but I have not been able to get ANY of
>these to print. I am using the following line in the USES section:

>Uses Wincrt,print;

>Then I put the lst code within a writeln statement. I copy a writeln
>statement which I know already works (it shows the results on the
>screen, so I know it works.....)

>The program is not written by me, but by the author of our textbook.
>The program runs just fine until I add the LST to the second writeln?
>I do not understand what I am doing wrong?

I'd guess you're using a course book which deals with some sort of
generic Pascal compiler, not one of the Borland ones and certainly not
one of the Windows ones. Uses clauses were introduced in UCSD Pascal
and copied by Borland; they are part of the language we use but they
were not part of the original language.

You'd be better off getting TP5.5 from the Borland website and
programming under DOS. DOS is not too difficult once your paths etc.
are set up. Open a DOS shell under Windows and then start up Turbo in
that. Then you can use the Printer unit and write to the Lst "file".
That will just send the ASCII codes to the PRN device.  In DOS, you
write text to the printer device and the printer does something
hopefully recognisable with it. Windows is more complicated...

FP



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Same guy, new problem... Having a time with getting the same code to print, pleez help if you can, as usual, TIA Richard A.

2. Help trying to print PAS files

3. Getting Date/Time from LAN Machine and Setting Date/Time on Client

4. Why am I not getting the RTE 200?

5. still having problem using Free Pascal for the first time

6. Anything and anything!!!!

7. Why am I getting an EDBEngineError?

8. DELPHI- Having trouble printing Delphi manuals

9. Setting NetFileDir at run-time ( still trying )

10. Deluxe Time Computation, 2nd try

11. Save your efforts and time. Try DejaNews

12. CL - D3 / paradox getting slower all the time ?

 

 
Powered by phpBB® Forum Software