gets

    5熱度

    2回答

    我想知道爲什麼當我試圖獲取不同的輸入時,它忽略了我的第二個輸入。 #!/usr/bin/env ruby #-----Class Definitions---- class Animal attr_accessor :type, :weight end class Dog < Animal attr_accessor :name def speak

    1熱度

    3回答

    我已經編寫了以下C代碼以獲取來自用戶的字符串列表。但存儲的字符串正在發出奇怪的值。 #include <stdio.h> #include <stdlib.h> #define MAX_STRING_LENGTH 50 void readInStrings(char* arr[],int n) { int i=0; char line[MAX_STRING_LE

    6熱度

    9回答

    我在我的C代碼中使用函數gets()。 我的代碼工作正常,但我得到一個警告消息 (.text+0xe6): warning: the `gets' function is dangerous and should not be used. 我想這個警告信息不彈出。有什麼辦法嗎? 我想知道可能有這樣的可能性通過創建一個頭文件來禁用一些警告。或者在編譯過程中有什麼選擇可以滿足我的目的?或者可能有一

    9熱度

    8回答

    我對C非常陌生,並且在將數據輸入到程序時遇到了問題。 我的代碼: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int a; char b[20]; printf("Input your ID: "); scanf("%d", &a);

    2熱度

    3回答

    我是相當新的C很抱歉,如果這是一個愚蠢的問題,但是當我運行下面的代碼: #include <stdio.h> int main() { int i; int test[10]; char string[81]; for(i = 0; i < 10; i++){ scanf("%d", &test[i]); } for(

    7熱度

    5回答

    我讀的輸入線路上的TCP套接字,與此類似: class Bla def getcmd @sock.gets unless @sock.closed? end def start srv = TCPServer.new(5000) @sock = srv.accept while ! @sock.closed? a

    14熱度

    2回答

    我使用gets來暫停我的腳本輸出,直到用戶點擊回車鍵。如果我沒有將任何參數傳遞給我的腳本,那麼它工作正常。不過,如果我傳遞任何參數給我的腳本然後獲取模具,出現以下錯誤: ruby main.rb -i main.rb:74:in `gets': No such file or directory - -i (Errno::ENOENT) from main.rb:74:in `gets