By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,216 Members | 1,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,216 IT Pros & Developers. It's quick & easy.

"paste" problem when reading user command from console

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a

<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.