Recent

Author Topic: debugger ignoring the READLN command  (Read 1687 times)

AfootDesert41

  • New Member
  • *
  • Posts: 15
debugger ignoring the READLN command
« on: December 23, 2018, 06:16:07 pm »
Hello, I was just starting a project for college, when I want to debug what I coded, the debugger just ignores the readln command on line 16. Please enlighten me on what is going on :(. Here is what I coded:
Code: Pascal  [Select][+][-]
  1. program Caja_Registradora_SupermercadoElCampo;
  2. uses crt,graph,sysutils;
  3. var  nombre_cajero,nombre_cliente,direccion_cliente,cedularif_cliente:string;
  4.        cont_ventas,num:integer;
  5.  
  6. begin
  7.   writeln('SISTEMA DE CAJA REGISTRADORA SUPERMERCADO EL CAMPO C.A');
  8.   writeln('DATOS DEL CAJERO');
  9.   writeln('NOMBRE DEL CAJERO:');
  10.   read(nombre_cajero);
  11.   ClrScr;                                                            
  12.   writeln('SISTEMA DE CAJA REGISTRADORA SUPERMERCADO EL CAMPO C.A');
  13.   writeln('CAJERO: ',nombre_cajero);
  14.   writeln('DATOS DEL CLIENTE');
  15.   writeln('NOMBRE:');
  16.   readln(nombre_cliente);
  17.   writeln('RIF/CEDULA:');
  18.   readln(cedularif_cliente);
  19.   writeln('DIRECCION DEL CLIENTE:');
  20.   readln(direccion_cliente);
  21.  
  22.  
  23.   readkey();
  24.  
  25.  
  26. end.
  27.  
« Last Edit: December 23, 2018, 06:20:09 pm by AfootDesert41 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11290
  • Debugger - SynEdit - and more
    • wiki
Re: debugger ignoring the READLN command
« Reply #1 on: December 23, 2018, 06:26:44 pm »
On which OS are you?

If Windows:
When you run your app, do you get a (black) console window, and do you see the output?

On Linux:
If you open menu View > Debug Windows > Console Output: Do you see the output of your program there?
Note that the "Console Output" is a simple console with no support for control sequences. So things like "ClrScr" from crt will not work.

------------
Also you point  to line 15.
Does that mean it works on line 10?

Again what OS (and if linux, do you use the above "console output"?
What OS version?

If you start outside the IDE, from a terminal: Does it work then?

If you start in the debugger and set a breakpoint: What is in nombre_cliente after the "ignored" readln?


AfootDesert41

  • New Member
  • *
  • Posts: 15
Re: debugger ignoring the READLN command
« Reply #2 on: December 23, 2018, 06:59:43 pm »
Hello, thanks for your willing to help! I am currently using windows. I just fixed my problem by changing the line 10 command from a read to a readln and everything just debugged as intended, just to clarify what was going on: the console would only print line 16 but won't let me enter the data (ignore the line 17 readln command) and it would just skip to the line 19 where there was another readln. I really don't know the reason for that, but that solution worked for me, thanks again! :)

jamie

  • Hero Member
  • *****
  • Posts: 6943
Re: debugger ignoring the READLN command
« Reply #3 on: December 23, 2018, 07:09:07 pm »
That is normal

READ is not wait for user input but if there is something sitting in the keyboard buffer it returns that.

READLN stops because it needs an ENTER or return character to continue and in this case that would be
the user.
 The LN attached means LINE , Read the line. Lines comes with a RETURN character that must get entered.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018