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