str = gets() str = gets(len)
String str; String str;
Integer len;
【詳細】
gets()は,標準入力から文字列を 1 行(改行コードを含まない)
あるいは 1023 個の文字を読み込み,文字列を返す。リターンキー
のみ入力すると,長さゼロの文字列を返す。
gets(len) は,ファイルから文字列を 1 行(改行コードを含まない)
あるいは len 個の文字を読み込む。
【例題】
標準入力からリターンのみが入力されるまで,データを読み込み,
標準出力に出力する。
while (length(str = gets())) {
printf("%s\n", str);
}
【参照】