avatar
s*l
1
for example, in a for or while loop, if we want to advances to next iteration
only after a key is hit (can be any key). How to do it?
I try getc() like below,but it advances to next iteration only after hitting
the RETURN key
for (;;) {
....
$junk = getc();
....
}
Thanks
avatar
p*f
2

Term::ReadKey
http://search.cpan.org/author/JSTOWE/TermReadKey-2.21/ReadKey.pm

【在 s*l 的大作中提到】
: for example, in a for or while loop, if we want to advances to next iteration
: only after a key is hit (can be any key). How to do it?
: I try getc() like below,but it advances to next iteration only after hitting
: the RETURN key
: for (;;) {
: ....
: $junk = getc();
: ....
: }
: Thanks

avatar
p*f
4

Term::ReadKey handles all the complex for you, so you can write several
lines of code to fulfill your task.
It is much difficult to do your own, but it is possible. check POSIX
module, and basically you write it as C code.

【在 s*l 的大作中提到】
: Is there any simple solution (eg. several lines of codes) rather than
: downloading this Term::ReadKey modules?

avatar
w*g
5
use ppm. it is a piece of cake.

【在 s*l 的大作中提到】
: Is there any simple solution (eg. several lines of codes) rather than
: downloading this Term::ReadKey modules?

avatar
m*m
6
Try this:
open FH, "$er = read FH, $in1, 1;
print $in1."\n";

iteration

【在 s*l 的大作中提到】
: for example, in a for or while loop, if we want to advances to next iteration
: only after a key is hit (can be any key). How to do it?
: I try getc() like below,but it advances to next iteration only after hitting
: the RETURN key
: for (;;) {
: ....
: $junk = getc();
: ....
: }
: Thanks

avatar
m*m
7
Try this:
open FH, "$er = read FH, $in1, 1;
print $in1."\n";

iteration

【在 s*l 的大作中提到】
: for example, in a for or while loop, if we want to advances to next iteration
: only after a key is hit (can be any key). How to do it?
: I try getc() like below,but it advances to next iteration only after hitting
: the RETURN key
: for (;;) {
: ....
: $junk = getc();
: ....
: }
: Thanks

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。