stdin

    -1热度

    2回答

    我正在编写一个程序,可以接受“.sql”文件或接受stdin中的SQL语句。问题来自stdin: Scanner scanner = new Scanner(new BufferedInputStream(System.in)); System.out.println("Enter SQL statements"); StringBuilder stringBuilder = new Stri

    0热度

    2回答

    我想写一个像sgtpep/pmenu在C的应用程序。 然后我开始看看ncurses库。我第一次尝试可以选择菜单。比如当我做ls | ./a.out时,应该可以显示所有文件,并突出显示第一个,当我按UP或DOWN时,它会相应地改变高亮不同的项目。 完整的代码是here。 该程序没有收到任何按键。 mvprintw(n+1, 0, "%d\n", ch);循环内总是打印-1。 然后我删除无关的代码,并

    0热度

    1回答

    创建字符串所以我试图编写一个程序,基本上通过内存分配,每个字符读取字符,但只通过键盘输入一个字符串创建一个字符串。我知道有很多(更好)的方法可以做到,但我想通过这种特殊的方式来做到这一点! 下面的代码: int newstring (char** string) { printf("--------------In function newstring--------------\n");

    0热度

    1回答

    我写了一个简单的代码与stdin和stdout两个数字相加的分别是输入和显示输出显示它们的总和: import sys print("Inputs:") for one in sys.stdin: break int(one) for two in sys.stdin: break int(two) three = 0 print("Output:") t

    -2热度

    1回答

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int i = scan.nextInt(); double d = scan.next

    2热度

    2回答

    我有这个小程序: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> int main() { int orig = 1; for (int i = 0; (i != 3) && orig; ++i) { orig = orig && fork()

    2热度

    1回答

    我正在编写一个PHP脚本,我希望能够可选使用文件作为脚本输入。通过这种方式: $ php script.php < file.txt 我,实际上,能够做到这一点使用file_get_contents: $data = file_get_contents('php://stdin'); 但是,如果我没有通过文件的输入,脚本挂indefinetelly,等待为输入。 我尝试以下,但它没有工作:

    0热度

    2回答

    我有这个小程序: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> int main() { int orig = 1; for (int i = 0; (i != 3) && orig; ++i) { orig = orig && fork()

    3热度

    1回答

    我已经研究了这个问题,我可以找到最接近的答案是这样的。 gdb - debugging with piped input (not arguments) 我需要做这个人究竟要求什么,但是,我需要能够发送输入后,已经看过我的程序运行的一部分。 这就是我要找的代码在GDB #define SECRET1 0x44 #define SECRET2 0x55 int main(int argc, c

    6热度

    1回答

    我想从Python调用一个程序,并且认为它的stdout是一个tty,即使Python的进程标准输出附加到管道上。所以我用了pty.spawn功能来实现这一点,可以从验证如下: $ python -c "import sys; from subprocess import call; call(sys.argv[1:])" python -c "import sys; print sys.stdo