Recent

Author Topic: readkey full text.  (Read 7267 times)

captian jaster

  • Guest
readkey full text.
« on: February 20, 2010, 02:38:50 pm »
Im trying to make it that when the user inputs a full word like "Close"
the program closes.
The problem is readkey only reads from one key
so as soon as i press one letter the programs error pops up!
what do i do??

Bart

  • Hero Member
  • *****
  • Posts: 5612
    • Bart en Mariska's Webstek
Re: readkey full text.
« Reply #1 on: February 20, 2010, 03:00:39 pm »
That would really depend on the situation.
If you are asking the user for a command to enter, just uses read() or readln().

Code: [Select]
var
  Answer: String;

  ...
  write('What to do next: ');
  readln(Answer);
  if UpperCase(Answer) = 'CLOSE' then CleanUpAndCloseMyPrettyProgram;
  ..

If this doen't apply to youre situation, please try to describe the situation where you would need this.

Bart

captian jaster

  • Guest
Re: readkey full text.
« Reply #2 on: February 20, 2010, 03:06:10 pm »
Thanks!
thats what i needed it to do!

Bart

  • Hero Member
  • *****
  • Posts: 5612
    • Bart en Mariska's Webstek
Re: readkey full text.
« Reply #3 on: February 21, 2010, 12:29:34 am »
You might consider reading some basic Pascal tutorial, for instance: http://www.algonet.se/~khaan/tutor/

Have fun!

Bart

 

TinyPortal © 2005-2018