Re: binary file and vc
I have written a program in C that reads the data from the file:
FILE *fp;
fp = fopen("C:\\Documents and Settings\\Ludo\\Bureau\\ezdata\\sample\
\sample1.ezd","rb");
if (!fp)
{
printf("Probleme d'ouverture de fichier\n");
}
else
{
char FormatVersion[100];
char FileNote[1024], XLable[50], YLable[50], XUnit[20], YUnit[20],
Name[100];
time_t Time;
float StepX, StepY, XStart;
long CurveCount,Number;
fread(FormatVersion,sizeof(char),strlen("__ezGet.net dataFormat
5__"),fp);
fread(FileNote, sizeof(char), 1024, fp);
fread(XLable, sizeof(char), 50, fp);
fread(YLable, sizeof(char), 50, fp);
fread(XUnit, sizeof(char), 20, fp);
fread(YUnit, sizeof(char), 20, fp);
fread(&CurveCount, sizeof(long), 1, fp);
fread(Name, sizeof(char), 100, fp);
fread(&Time, sizeof(time_t), 1, fp);
fread(&StepX, sizeof(float), 1, fp);
fread(&StepY, sizeof(float), 1, fp);
fread(&XStart, sizeof(float), 1, fp);
fread(&Number, sizeof(long), 1, fp);
fclose(fp);
printf("test:\n");
printf("FormatVersion=%s\n", FormatVersion);
printf("FileNote=%s\n", FileNote);
printf("XLable=%s\n", XLable);
printf("YLable=%s\n", YLable);
printf("XUnit=%s\n", XUnit);
printf("YUnit=%s\n", YUnit);
printf("CurveCount=%l\n", CurveCount);
printf("Name=%s\n", Name);
printf("Time=%d\n",Time);
printf("StepX=%f\n",StepX);
printf("StepY=%f\n",StepY);
printf("XStart=%f\n",XStart);
printf("Number=%l\n",Number);
}
And I get this :
FormatVersion=__ezGet.net dataFormat 5__
FileNote=This is the <u>native data</u> for ezDatar.<font
size='+4'>Now</font>, you can use <b>simple</b> <i>HTML</i> tag(s) in
the note.
XLable=Time
YLable=Res.
XUnit=Sec.
YUnit=mV
CurveCount=
Name=ce
Time=1077228647
StepX=0.250000
StepY=0.000000
XStart=0.000000
Number=
The problem seems to be only with variables of long type. The other
variables are float, char and time_t type and the values seem to be
ok.