1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
// VC5.cpp : Defines the entry point for the console application.
//
/clr
#include "stdafx.h"
#include <fstream>
#include <iomanip>
#include <iostream>
#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);
}
|