Unix questions - paste" problem when reading user command from console

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > November 2005 > paste" problem when reading user command from console





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author paste" problem when reading user command from console
kimso.zhao@gmail.com

2005-11-29, 5:58 pm

Hi all,


When I tried reading user command from console, I use "select" to wait
for user input in order to improve efficiency. But when it comes to
dealing with user pasting a command, there is a problem. Only the first

character of the pasted command can be displayed. But the command is
actually there, if you typed any one more key, the whole pasted command

will be displayed. Here is the code. Do you have any way to get through

this? Thanks.


while {
select_result = select (1, &read_fds, 0, 0 , NULL); // listen
for user input from stdin

// error handling for select function.

ch = getch();

printf("%c",ch);

}


Problem - when you paste a comand, e.g. activate, only the first
charcter 'a' is printed, and if you type any one more key, the whole
command "activate" will be printed.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com