* * *

Author Topic: Readln bug Windows10 Update  (Read 1029 times)

rteesdale

  • Newbie
  • Posts: 2
Readln bug Windows10 Update
« on: May 12, 2018, 04:30:21 am »
Hello,
I have an issue that I'm pretty sure is not unique to me, I just can't seem to find answers anywhere.

Well....Don't I feel silly.... As soon as I posted this I found a workaround that is very useful right here!

http://forum.lazarus.freepascal.org/index.php/topic,36400.0.html

Moderators...feel free to delete!

The code below will throw an Error 106 when compiled and run as is.

I've determined that for some reason the combination of two strings read before the real (multiple readln) is causing an issue.

This only began after the April Windows 10 x64 updates.

I'm having the issue on both free pascal 3.0.4 and Lazarus Release 1.8.2 (with FPC 3.0.4) (Which is obvious)

I have no issue with Linux fpc 3.0.0

Since I really believe that this is a Windows 10 issue, is there any suggested work around?

Code: Pascal  [Select]
  1.  
  2. program Windows10_Error_106;
  3. var
  4.   fname, lastName: string;
  5.     amountPaid: real;
  6.  
  7. begin
  8.   writeln('Enter your first name');
  9.   readln(fname);
  10.   writeln('enter your last name');
  11.   readln(lastName);
  12.   writeln(fname, lastName);
  13.   writeln('Enter amount paid');
  14.  
  15.   readln(amountPaid);
  16.   writeln(fname, lastName, amountPaid);
  17.   readln;
  18. end.
  19.  
  20.  
« Last Edit: May 12, 2018, 04:47:43 am by rteesdale »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 740
Re: Readln bug Windows10 Update
« Reply #1 on: May 12, 2018, 04:56:24 am »
hello,
i have no error with Windows 10 version 10.0.16299.431  64 bits, Lazarus 1.8.2 32 bits.
Are you using the 64 bits version of Lazarus ?

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

ASerge

  • Hero Member
  • *****
  • Posts: 941
Re: Readln bug Windows10 Update
« Reply #2 on: May 12, 2018, 04:57:42 am »
The code below will throw an Error 106 when compiled and run as is.
Code: Pascal  [Select]
  1.  
  2. ...
  3.     amountPaid: real;
  4. begin
  5. ...
  6.   readln(amountPaid);
As far as I know, error 106 means that reading fails to convert to a number.

rteesdale

  • Newbie
  • Posts: 2
Re: Readln bug Windows10 Update
« Reply #3 on: May 12, 2018, 05:39:32 am »
@Jurassic Pork,

It's a console buffering issue...using the crt library clrscr; did the trick!

@ASerge yup, string data in the buffer was finding its way into the readln(num), which was expecting a real

Thanks for trying to help!

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus