Forum > General

readkey full text.

(1/1)

captian jaster:
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:
That would really depend on the situation.
If you are asking the user for a command to enter, just uses read() or readln().


--- Code: ---var
  Answer: String;

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

--- End code ---

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

Bart

captian jaster:
Thanks!
thats what i needed it to do!

Bart:
You might consider reading some basic Pascal tutorial, for instance: http://www.algonet.se/~khaan/tutor/

Have fun!

Bart

Navigation

[0] Message Index

Go to full version