るりまサーチ

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

別のキーワード

  1. struct new
  2. mkmf have_struct_member
  3. struct each
  4. struct select
  5. struct []

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 3 >>

Array#pack(template) -> String (13.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

..."
[0x7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0,...
...x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00".unpack("p") # => [nil]
//}

: 構造体のアドレス

例えば、
//emlist{
struct
{
int a;
short b;
long c;
} v = {1,2,3};
//}
を表す文字列は
//emlist[][ruby]{
v = [1,2,3].pack("i!s!...

Array#pack(template, buffer: String.new) -> String (13.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

..."
[0x7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0,...
...x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00".unpack("p") # => [nil]
//}

: 構造体のアドレス

例えば、
//emlist{
struct
{
int a;
short b;
long c;
} v = {1,2,3};
//}
を表す文字列は
//emlist[][ruby]{
v = [1,2,3].pack("i!s!...

String#unpack(template) -> Array (13.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

..."
[0x7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0,...
...x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00".unpack("p") # => [nil]
//}

: 構造体のアドレス

例えば、
//emlist{
struct
{
int a;
short b;
long c;
} v = {1,2,3};
//}
を表す文字列は
//emlist[][ruby]{
v = [1,2,3].pack("i!s!...
<< < 1 2 3 >>