るりまサーチ

最速Rubyリファレンスマニュアル検索!
180件ヒット [101-180件を表示] (0.080秒)

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io each_line
  5. io readlines

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 >>

IO#sysread(maxlen, outbuf = "") -> String (9041.0)

read(2) を用いて入力を行ない、入力されたデータを 含む文字列を返します。stdio を経由しないので gets や getc や eof? などと混用すると思わぬ動作 をすることがあります。

...read(2) を用いて入力を行ない、入力されたデータを
含む文字列を返します。stdio を経由しないので gets や getc や eof? などと混用すると思わぬ動作
をすることがあります。

バイナリ読み込みメソッドとして動作します。

...
...します。

@param maxlen 入力のサイズを整数で指定します。

@param outbuf 出力用のバッファを文字列で指定します。IO#sysread は読み込んだデータを
その文字列オブジェクトに上書きして返します。指定した文字列オブ...
...小)されたあと、実際に読み込んだデータのサイズになります。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

@raise EOFError IO が既に EOF に達していれば発生します。

@raise Errno::EXXX データの読み込...

Zlib::GzipReader#ungetc(char) -> nil (6157.0)

IO クラスの同名メソッド IO#ungetc と同じです。

...IO クラスの同名メソッド IO#ungetc と同じです。

IO
クラスの同名メソッドと同じですが、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。

gzip ファイルのフッターの処理に注意して...
...Zlib::GzipReader.open('hoge.gz') { |gz|
begin
c1 = gz.getc
c2 = gz.getc
break if c2.nil?
printf "%c -> %c\n", c1, c2
gz.ungetc(c2)
end while true
}

#=> h -> o
#=> o -> g
#=> g -> e
#=> e -> f
#=> f -> u
#=> u -> g
#=> g -> a

@see IO#ungetc...

OpenSSL::Buffering#ungetc(char) -> () (6107.0)

指定した文字 char をバッファに読み戻します。

...指定した文字 char をバッファに読み戻します。

char には String か Integer を渡します。

IO
#ungetc と同様です。

@param char 読み戻す文字...

String#chr -> String (37.0)

self の最初の文字だけを含む文字列を返します。

...de"
a.chr #=> "a"
//}

Ruby 1.9 で IO#getc の戻り値が Integer から String を返すように変更になりました。
Ruby 1.8 以前と1.9以降の互換性を保つために String#chr が存在します。

例:
# ruby 1.8 系では STDIN.getc が 116 を返すため Integer#chr...
...が呼び出される
$ echo test | ruby -e "p STDIN.getc.chr" # => "t"
# ruby 1.9 系以降では STDIN.getc が "t" を返すため String#chr が呼び出される
$ echo test | ruby -e "p STDIN.getc.chr" # => "t"

@see String#ord, Integer#chr...

ARGF.class#gets(limit) -> String | nil (13.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

ARGF.class#gets(limit, chomp: false) -> String | nil (13.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/) -> String | nil (13.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/, chomp: false) -> String | nil (13.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs, limit) -> String | nil (13.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs, limit, chomp: false) -> String | nil (13.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

<< < 1 2 >>