BinaryReader.ReadInt32 メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > BinaryReader.ReadInt32 メソッドの意味・解説 

BinaryReader.ReadInt32 メソッド

現在のストリームから 4 バイト符号付き整数読み取りストリーム現在位置を 4 バイトだけ進めます

名前空間: System.IO
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

例外例外
例外種類条件

EndOfStreamException

ストリーム末尾到達しました

ObjectDisposedException

ストリーム閉じられました。

IOException

I/O エラー発生しました

解説解説
使用例使用例

このコード例は、BinaryReader クラストピック取り上げているコード例一部分です。

Dim binReader As New BinaryReader(
 _
    File.Open(fileName, FileMode.Open))
Try

    ' If the file is not empty, 
    ' read the application settings.
    If binReader.PeekChar() <> -1 Then
        aspRatio   = binReader.ReadSingle()
        lkupDir     = binReader.ReadString()
        saveTime  = binReader.ReadInt32()
        statusBar = binReader.ReadBoolean()
        Return
    End If

' If the end of the stream is reached before reading
' the four data values, ignore the error and use the
' default settings for the remaining values.
Catch ex As EndOfStreamException
    Console.WriteLine("{0} caught and ignored. " &
 _ 
        "Using default values.", ex.GetType().Name)
Finally
    binReader.Close()
End Try
BinaryReader binReader = 
    new BinaryReader(File.Open(fileName, FileMode.Open));
try
{
    // If the file is not empty, 
    // read the application settings.
    if(binReader.PeekChar() != -1)
    {
        aspectRatio   = binReader.ReadSingle();
        lookupDir     = binReader.ReadString();
        autoSaveTime  = binReader.ReadInt32();
        showStatusBar = binReader.ReadBoolean();
    }
}

// If the end of the stream is reached before reading
// the four data values, ignore the error and use the
// default settings for the remaining values.
catch(EndOfStreamException e)
{
    Console.WriteLine("{0} caught and ignored. " + 
        "Using default values.", e.GetType().Name);
}
finally
{
    binReader.Close();
}
BinaryReader^ binReader = gcnew BinaryReader( File::Open( fileName, FileMode::Open
 ) );
try
{
   
   // If the file is not empty, 
   // read the application settings.
   if ( binReader->PeekChar() != -1 )
   {
      aspectRatio = binReader->ReadSingle();
      lookupDir = binReader->ReadString();
      autoSaveTime = binReader->ReadInt32();
      showStatusBar = binReader->ReadBoolean();
      return;
   }
}
// If the end of the stream is reached before reading
// the four data values, ignore the error and use the
// default settings for the remaining values.
catch ( EndOfStreamException^ e ) 
{
   Console::WriteLine( "{0} caught and ignored. "
   "Using default values.", e->GetType()->Name
 );
}
finally
{
   binReader->Close();
}


BinaryReader binReader =
    new BinaryReader(File.Open(fileName, FileMode.Open));
try {
    // If the file is not empty, 
    // read the application settings.
    if ( binReader.PeekChar() !=-1  ) {
        aspectRatio = binReader.ReadSingle();
        lookupDir = binReader.ReadString();
        autoSaveTime = binReader.ReadInt32();
        showStatusBar = binReader.ReadBoolean();
    }
}

// If the end of the stream is reached before reading
// the four data values, ignore the error and use the
// default settings for the remaining values.
catch(EndOfStreamException e) {
    Console.WriteLine("{0} caught and ignored. "
        + "Using default values.", e.GetType().get_Name());
}
finally {
    binReader.Close();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からBinaryReader.ReadInt32 メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からBinaryReader.ReadInt32 メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からBinaryReader.ReadInt32 メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

BinaryReader.ReadInt32 メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



BinaryReader.ReadInt32 メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS