[comp.lang.pascal] Bug in TP4 printer-unit

bjornb@rhi.hi.is (Bjorn H Bjornsson) (05/26/88)

When you do a write(lst, chr(26)) in Turbo Pascal 4.00 the character 26
(Ctrl-Z) gets lost.  This is absolutely fatal when you're printing
special codes, and VERY annoying when you're doing printer-graphics
(which is how the bug introduced itself).
This same code works alright in TP3.

The bug's probably in the Printer unit, (it just occured to me though,
that Write itself might be faulty). 

...

And a question:

Now that compiler directives $g and $p are no longer with us, has anyone
figured out how to do redirection in TP4?

	Sincerely yours,
	Bjossi
-- 
Bjorn Heimir Bjornsson		Internet:  bjornb@rhi.hi.is
University of Iceland		UUCP:	   {mcvax,enea}!hafro!rhi!bjornb

leonard@bucket.UUCP (Leonard Erickson) (05/30/88)

In article <304@krafla.rhi.hi.is> bjornb@krafla.UUCP (Bjorn H Bjornsson) writes:
<When you do a write(lst, chr(26)) in Turbo Pascal 4.00 the character 26
<(Ctrl-Z) gets lost.  This is absolutely fatal when you're printing
<special codes, and VERY annoying when you're doing printer-graphics
<(which is how the bug introduced itself).
<This same code works alright in TP3.
<
<The bug's probably in the Printer unit, (it just occured to me though,
<that Write itself might be faulty). 

This not a bug. It's a feature. :-( 

What's happening is that TP3 opened the printer in "raw" mode, while TP4
opens it in "cooked" mode. You might try writing Borland for a work around.

-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."

swarbric@tramp.Colorado.EDU (Frank Swarbrick) (06/10/88)

In article <319@krafla.rhi.hi.is> bjornb@krafla.UUCP (Bjorn H Bjornsson) writes:
>  Some feature!
>  You can print all char's from 0 to 255 except 26.  Can anyone give me
>a single reason (or more) why you sholdn't be able to print CTRL-Z?

CP/M used Ctrl-Z to mean End Of File.  This was carried over into MS-DOS,
though it is rather obsolete, now.  TP4 obviously thinks you are closing the
file, or something.  I think if you do ^P^Z instead of #26 you can get it
to print.  Maybe not...I only have TP3.

Frank Swarbrick (and, yes, the net.cat)           swarbric@tramp.Colorado.EDU
...!{ncar|nbires}!boulder!tramp!swarbric
"...This spells out freedom, it means nothing to me, as long as there's a PMRC"

agollum@engr.uky.edu (Kenneth Herron) (06/10/88)

In episode <319@krafla.rhi.hi.is>, we
heard bjornb@krafla.UUCP (Bjorn H Bjornsson) say:
>><When you do a write(lst, chr(26)) in Turbo Pascal 4.00 the character 26
>><(Ctrl-Z) gets lost.  This is absolutely fatal when you're printing
>><special codes, and VERY annoying when you're doing printer-graphics
>
>  You can print all char's from 0 to 255 except 26.  Can anyone give me
>a single reason (or more) why you sholdn't be able to print CTRL-Z?

The *REASON* is that Lst is defined as a text file, and opened as
such.  DOS treats ^Z as end-of-file, and evidently strips it from 
printer output (or maybe turbo's doing it).  You'd see the same thing
happen if you printed to disk, I imagine.

To print ^Z to the printer, try this:

var
    Lst: file of char;

[...]
assign(Lst, 'PRN'); { Or LPT, or LPT1, or COM1, or whatever }
reset(Lst);   { or ReWrite; I believe they'd work the same here }
[...]

Kenneth Herron

leonard@bucket.UUCP (Leonard Erickson) (06/11/88)

In article <319@krafla.rhi.hi.is> bjornb@krafla.UUCP (Bjorn H Bjornsson) writes:
<><When you do a write(lst, chr(26)) in Turbo Pascal 4.00 the character 26
<><(Ctrl-Z) gets lost.  This is absolutely fatal when you're printing
<><special codes, and VERY annoying when you're doing printer-graphics
<>
<>What's happening is that TP3 opened the printer in "raw" mode, while TP4
<>opens it in "cooked" mode. You might try writing Borland for a work around.
<
<  Some feature!
<  You can print all char's from 0 to 255 except 26.  Can anyone give me
<a single reason (or more) why you sholdn't be able to print CTRL-Z?

Check again! Some of those other codes are being played with too. At the very
tabs are being expanded. As I understand it, it wasn't really intentional, they
just used a different DOS or BIOS call (or made the call differently?)

I vaguely remember seeing a 'fix' on the Borland forum on Compuserve, but it
may have been a replacement unit! You might try writing Borland, as I imagine
that CIS is a bit expensive from Europe!

-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."