[comp.lang.pascal] Turbo Bug<s>

kmzvokel@bsu-cs.bsu.edu (Kenneth M. Zvokel) (07/04/89)

Does anyone out there know why when sending values to the printer thru Turbo
Pascal that values get corrupted.  For instances I have a value that when printed to the screen has the value of 0 (correct) when it reaches the printer it
has any one of a number of values (28009, 25632, 12336).  I have found other places where ocassionaly a value will become corrupted because they are not initialized
but this is not the case here.


Any help would be greatly appreciated


ken zvokel

abcscnuk@csuna.csun.edu (Naoto Kimura) (07/07/89)

In article <8048@bsu-cs.bsu.edu> kmzvokel@bsu-cs.bsu.edu (Kenneth M. Zvokel) writes:
>Does anyone out there know why when sending values to the printer thru Turbo
>Pascal that values get corrupted.  For instances I have a value that when printed to the screen has the value of 0 (correct) when it reaches the printer it
>has any one of a number of values (28009, 25632, 12336).  I have found other places where ocassionaly a value will become corrupted because they are not initialized
>but this is not the case here.
>
>
>Any help would be greatly appreciated
>
>
>ken zvokel

I think that you should clarify what is going on.  Your description of
your problem doesn't show much about the nature of the problem.  What do
you mean that you are printing a value to the screen and the printer ?
Do you mean that you printed the value of a variable ?  Perhaps a code
fragment would help.  Make sure that you've turned on the runtime checks
(as this is not the default -- which is unfortunate for those people who
need it the most won't know that they need to turn it on).  Up to and
including version 3.0, you had to make sure that you recompiled the
program each time you ran it (especially if you used typed constants,
which are only initialized when the program is compiled into memory or
loaded from disk at the DOS command prompt).  If you're using version
5.0 or later, then I would suggest using the watch window to keep an eye
on your variables.

                //-n-\\			 Naoto Kimura
        _____---=======---_____		 (abcscnuk@csuna.csun.edu)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!

leonard@bucket.UUCP (Leonard Erickson) (07/08/89)

kmzvokel@bsu-cs.bsu.edu (Kenneth M. Zvokel) writes:

<Does anyone out there know why when sending values to the printer thru Turbo
<Pascal that values get corrupted.  For instances I have a value that when printed to the screen has the value of 0 (correct) when it reaches the printer it
<has any one of a number of values (28009, 25632, 12336).  I have found other places where ocassionaly a value will become corrupted because they are not initialized
<but this is not the case here.

Could you post (or mail) an example? Without one, it gets rather difficult
to track down.

My guess would be that the variable is getting overwritten by something
else. Enable range checking and try again. Also, try changing your
write(lst,var) to write(var) rather than inserting a write(var) in
the code. This can make a big difference.

Finally, if you have version 5 step through the code with the debugger.
And set up a watch on the variable. Then you'll know where it gets clobbered
and only have to figure out *why*.
-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I'm all in favor of keeping dangerous weapons out of the hands of fools.
Let's start with typewriters." -- Solomon Short

LAUFMAN-H@osu-20.ircc.ohio-state.edu (Harry Laufman) (07/13/89)

KMZVOKEL writes :
> ...when sending values to the printer thru Turbo Pascal that
> certain values get corrupted.
I recall reading in something.virus that at least one virus infects
the BIOS so that sequences sent to the printer are corrupted in a
diabolical fashion, ie. only certain, random sequences are corrupted,
etc.  This is NOT a Turbo only virus, it seems all output to the
printer would be effected.  If other printer sequences are Ok, like
COPY Numbers.txt Prn: ,etc. then I guess you're virus free.
As always : Check your dip switchs.
Harry