当前位置: 动力学知识库 > 问答 > 编程问答 >

c - GNU readline: avoid prompt string in output if input is not interactive

问题描述:

I have a readline-based application with a prompt, however I'd like it to not show when the input is not interactive.

$ ./readline-app < command-list > result

$ cat result

prompt> Output line 1

prompt> Output line 2

prompt>

$

How can I make the prompt to not print in this case?

网友答案:

Use isatty(3) to determine whether stdin and/or stdout are connected to a tty.

分享给朋友:
您可能感兴趣的文章:
随机阅读: