#pragma warning(disable : 4996)
#include
int main() {
FILE* fp;
if ((fp = fopen("C:\\softca\\VB\\SAMP0250.DAT", "wb")) == NULL){
}
else {
long long i;
for (i = 1; i < 0x100000000000; i += 0x11111111111) {
fwrite(&i, 1, sizeof(i), fp);
}
i = -1;
fwrite(&i, 1, sizeof(i), fp);
i = -0x1111;
fwrite(&i, 1, sizeof(i), fp);
fclose(fp);
}
}
ビルド
実行
して、データファイルを作成
Visual Basic側ソース
Imports System
Module Program
Sub Main()
Dim m_fs As System.IO.FileStream
m_fs = System.IO.File.Open("C:\\softca\\VB\\SAMP0250.DAT", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None)
Dim rc
Dim mm_byte(2000) As Byte
rc = m_fs.Read(mm_byte, 0, 2000)
Dim mm_long As Long
Dim i As Integer
Dim mm_max As Integer
mm_max = Int(rc / 8)
For i = 0 To mm_max - 1
mm_long = System.BitConverter.ToInt64(mm_byte, 8 * i)
Console.WriteLine("" & i & " : " & mm_long & " " & Hex(mm_long))
Next
Console.WriteLine("---")
Dim mm_inte As Integer
mm_max = Int(rc / 4)
For i = 0 To mm_max - 1
mm_inte = System.BitConverter.ToInt32(mm_byte, 4 * i)
Console.WriteLine("" & i & " : " & mm_inte & " " & Hex(mm_inte))
Next
End Sub
End Module