由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - a perl question
相关主题
Perl Qwhat is the difference between pthread and thr_ ?
[转载] 新手问perl的初级问题does Linux has real time timer?
how to handle *.pkg files?multithread question
Matrix inverse problemwhich shell is the best among csh, ksh, bsh?
file descriptorpthread_kill SIGINT SIG_DFL multithread
[转载] alarm, pause 又一问async-signal safe 问题
Does Linux support thread?Socket programming help
A Unix question多次遇到这种问题:previous declaration of .....
相关话题的讨论汇总
话题: iteration话题: getc话题: key话题: fh话题: advances
进入Unix版参与讨论
1 (共1页)
s*l
发帖数: 10
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
p******f
发帖数: 162
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

s*l
发帖数: 10
3
Is there any simple solution (eg. several lines of codes) rather than
downloading this Term::ReadKey modules?

【在 p******f 的大作中提到】
:
: Term::ReadKey
: http://search.cpan.org/author/JSTOWE/TermReadKey-2.21/ReadKey.pm

p******f
发帖数: 162
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?

w*******g
发帖数: 51
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?

m*m
发帖数: 47
6
Try this:
open FH, "<&1" ;
$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

m*m
发帖数: 47
7
Try this:
open FH, "<&1" ;
$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

1 (共1页)
进入Unix版参与讨论
相关主题
多次遇到这种问题:previous declaration of .....file descriptor
Can I get the CPU-time of a thread?[转载] alarm, pause 又一问
[转载] 写程序 通讯 的 API (IPC )Does Linux support thread?
[转载] Unix/Posix system programming trainingA Unix question
Perl Qwhat is the difference between pthread and thr_ ?
[转载] 新手问perl的初级问题does Linux has real time timer?
how to handle *.pkg files?multithread question
Matrix inverse problemwhich shell is the best among csh, ksh, bsh?
相关话题的讨论汇总
话题: iteration话题: getc话题: key话题: fh话题: advances