voici mon code, il génère des erreurs, j'essaie d'extraire les data du binaire binaireet de les mettre en tableau
// VC5.cpp : Defines the entry point for the console application.
//
/clr
#include "stdafx.h"
#include <fstream>
#include
#include
#include <cstring>
#include "stdio.h"
#include "stdlib.h"
#include <vcclr.h>
#include <vector>
using namespace std;
using namespace System;
FILE *fp1;
//Variable
char * prt_info;
long recl,lenr,numf,numx,numy;
float xmin,xmax,ymin,ymax;
//Struct
struct Arr
{
float *X;
float *Y;
float *Z;
float *A;
float *B;
float *C;
float *F;
long numofRec;
};
int main()
{
System::String^ str;
//Number of records
int num_rec = 0;
int i=0;
//Declare struct
Arr info[1];
pin_ptr<const wchar_t> wch = PtrToStringChars(str);
// Convert to a char*
size_t origsize = wcslen(wch) + 1;
const size_t newsize = 1000;
size_t convertedChars = 0;
char nstring[newsize];
wcstombs_s(&convertedChars, nstring, origsize, wch, _TRUNCATE);
//strcat_s(nstring, " (char *)");
errno_t err;
//Read from data file
if((err=fopen_s(&fp1,"C:\Sample\raysdetector.dis","rb"))!=0)
fread(&recl,sizeof(recl),1,fp1);
lenr=recl/256/4;
fseek(fp1,28+24,0);
fread(&numf,sizeof(numf),1,fp1);
fseek(fp1,3*28+16,0);
fread(&ymin,4,1,fp1);
fread(&ymax,4,1,fp1);
fread(&numy,4,1,fp1);
fseek(fp1,4*28+16,0);
fread(&xmin,4,1,fp1);
fread(&xmax,4,1,fp1);
fread(&numx,4,1,fp1);
for (long i=1;i<numy;i++)
{
fread(info[i].X,4,1,fp1);
fread(info[i].Y,4,1,fp1);
fread(info[i].Z,4,1,fp1);
fread(info[i].A,4,1,fp1);
fread(info[i].B,4,1,fp1);
fread(info[i].C,4,1,fp1);
fread(info[i].F,4,1,fp1);
info[i].numofRec=i;
printf("info[i].numofRec");
}
fclose(fp1);
}
'VC5.exe': Loaded 'E:\VC5\VC5\Debug\VC5.exe', Symbols loaded.
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\kernel32.dll'
'VC5.exe': Unloaded 'C:\WINDOWS\SysWOW64\kernel32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\ntdll.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\mscoree.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\kernel32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\advapi32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\rpcrt4.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\secur32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcr90d.dll', Symbols loaded.
'VC5.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcm90d.dll', Symbols loaded.
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\ole32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\msvcrt.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\gdi32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\user32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcp90d.dll', Symbols loaded.
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\CLKERN.DLL', Binary was not built with debug information.
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\shlwapi.dll'
'VC5.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll'
'VC5.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\msvcr80.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\shell32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\WinSxS\wow64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_5FA17F4E\comctl32.dll'
'VC5.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll'
'VC5.exe': Unloaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll'
'VC5.exe': Loaded 'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\32e6f703c114f3a971cbe706586e3655\mscorlib.ni.dll'
'VC5.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'VC5.exe' (Managed): Loaded 'e:\VC5\VC5\Debug\VC5.exe', Symbols loaded.
'VC5.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll'
'VC5.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\rsaenh.dll'
'VC5.exe': Loaded 'C:\WINDOWS\SysWOW64\psapi.dll'
'VC5.exe' (Managed): Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597C3456\msvcm90d.dll', Symbols loaded.
'VC5.exe': Loaded 'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\ba0e3a22211ba7343e0116b051f2965a\System.ni.dll'
'VC5.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
First-chance exception at 0x102670ef (msvcr90d.dll) in VC5.exe: 0xC0000005: Access violation reading location 0x00000000.
A first chance exception of type 'System.AccessViolationException' occurred in VC5.exe
An unhandled exception of type 'System.AccessViolationException' occurred in VC5.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
The thread 'Win32 Thread' (0x11a4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xe04) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1204) has exited with code 0 (0x0).
The program '[4436] VC5.exe: Managed' has exited with code 0 (0x0).
The program '[4436] VC5.exe: Native' has exited with code 0 (0x0).