「ライブラリの基礎 - C++DLL」の版間の差分
ナビゲーションに移動
検索に移動
→サンプルコード
289行目: | 289行目: | ||
for (int i = 0; i < structFuga.length; i++) | for (int i = 0; i < structFuga.length; i++) | ||
{ | { | ||
// IntPtr型からdouble型の数値を取得するときは、一度Int64型に変換して、これをBitConverter.Int64BitsToDoubleメソッドでdouble型に変換する | |||
var v = Marshal.ReadInt64(structFuga.data, i * sizeof(double)); | var v = Marshal.ReadInt64(structFuga.data, i * sizeof(double)); | ||
Console.WriteLine("data[{0}] = {1}", i, BitConverter.Int64BitsToDouble(v)); | Console.WriteLine("data[{0}] = {1}", i, BitConverter.Int64BitsToDouble(v)); |