471,584 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,584 software developers and data experts.

"paste" problem when reading user command from console

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.

Nov 29 '05 #1
1 1745

<ki********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
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.


Those look like platform-specific commands to me. You should ask in a
newsgroup devoted to your platform. Windows, perhaps?

-Howard


Nov 29 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by Alf P. Steinbach | last post: by
1 post views Thread by Nicolas Verhaeghe | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.