Questions tagged [readkey]

ReadKey() is a console method for obtaining the next character pressed by the user.

41 questions
0
votes
1 answer

VB.NET 2010 Console Application Wait for a key for 5 seconds, carry on if not

Ok, so I've tried looking up on several Google sites and cannot find an answer for this. Its in VB.Net as a Console Application, the way I want to set this up is almost like BIOS entry, when you turn your computer on you have several seconds to…
0
votes
1 answer

C# Conversion of ReadKey() to int

I am new to C# and was told to create a Text-based Pokemon Battle Simulator, so in the code below, I have a method to get the user input and decide which nature the Pokemon get : public static void NatureSelection(out int statIndex1, out int…
LegacyKS
  • 15
  • 3
  • 8
0
votes
1 answer

C# Console Application Keypress capturing

Is it possible to check pressed keys in a Console Application in any other way than Console.ReadKey()? I've changed the project settings to Windows Application so that the console window won't show. But if the console window isn't shown the…
0
votes
4 answers

C# - Use ReadKey for loop

I have been searching the web for about an hour and I just can't find the answer to my question. I'm very new to programming and I hope I'm not wasting your time. I want my program to loop if I would click "Y", exit if I click "N" and do nothing if…
Arvin Ashrafi
  • 621
  • 2
  • 7
  • 9
0
votes
3 answers

Cancelling Console.ReadKey() using code, not in-program

So let's use this code: Console.ReadKey(true); //Cancel the ReadKey prompt Console.WriteLine("ReadKey was cancelled."); Upon running the program, the only thing that should happen is that the output ReadKey was cancelled. should appear. How can I…
Adam
  • 612
  • 4
  • 13
  • 23
0
votes
0 answers

How to return an ascii character in SDL (freepascal)

I want to read an ascii key from the keyboard using SDL under freepascal. I don't care about the pressing of shift, ctrl, caps, etc--just things that would normally produce a character when typed in a typical application. The problem is that I…
Angelo
  • 328
  • 4
  • 14
0
votes
3 answers

How can I limit user input to a single alpha character in c#?

I'm using the following code to accept user input. I want to limit user input to a single alpha (a-z) character only. I'm finding a lot of validations using IsNumber to validate integer input, and a lot of information about using a regex on an input…
dwwilson66
  • 6,806
  • 27
  • 72
  • 117
0
votes
1 answer

Safe way to establish the initial state again.

Is there a possibility of calling the function main without the function _end_win being called? #!/usr/bin/env perl use warnings; use strict; use 5.10.0; use Term::ReadKey; use constant { NEXT_getch => -1, CONTROL_C => 0x03, …
sid_com
  • 24,137
  • 26
  • 96
  • 187
-1
votes
1 answer

Event by Key entered while Console.Readline is running

I am developing a project that does something specific by typing a command like a terminal on Mac OS. The problem is that Console.ReadLine and Console.ReadKey methods do not share threads with each other. For example, I am creating a program that…
Bae Bae
  • 3
  • 1
-1
votes
1 answer

Handling return values of ReadKey

Program Example3; uses Crt; { Program to demonstrate the ReadKey function. } var ch : char; begin writeln('Press Left/Right, Esc=Quit'); repeat ch:=ReadKey; case ch of #0 : begin ch:=ReadKey; {Read ScanCode} …
-2
votes
2 answers

I want to make a snake game in a C# console, movement problem

To change snakes direction I first have to press upArrow and then the new direction of the snake, and the snake is going in that direction until I hit upArrow again. So, to change direction to the left you need to press upArrow and then leftArrow. I…
Ognjen
  • 3
  • 2
1 2
3