Z
zhengv
Unregistered / Unconfirmed
GUEST, unregistred user!
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
typedef struct {
unsigned long date;
unsigned long open;
unsigned long high;
unsigned long low;
unsigned long close;
unsigned long travl;
unsigned long traca;
char unuse[12];
} RECORD;
RECORD reco;
int readrec(FILE *);
void main()
{
FILE *fp;
if((fp = fopen("01.day","rb")) == NULL)
{ printf("Error: Can't open 01.DAY !/n");
exit(0);
}
readrec(fp);
fclose(fp);
if(getch()==0) getch();
exit(0);
}
int readrec(FILE *fp)
{
float fn;
while (! feof(fp)) {
fread(&reco,sizeof(RECORD),1,fp);
printf("%10lu ",reco.date);
fn=float(reco.open)/1000;
printf("%8.2f ",fn);
fn=float(reco.high)/1000;
printf("%8.2f ",fn);
fn=float(reco.low)/1000;
printf("%8.2f ",fn);
fn=float(reco.close)/1000;
printf("%8.2f ",fn);
printf("%8lu ",reco.travl);
printf("%8lu/n",reco.traca);
}
printf("/n");
return 0;
}
#include <conio.h>
#include <stdlib.h>
typedef struct {
unsigned long date;
unsigned long open;
unsigned long high;
unsigned long low;
unsigned long close;
unsigned long travl;
unsigned long traca;
char unuse[12];
} RECORD;
RECORD reco;
int readrec(FILE *);
void main()
{
FILE *fp;
if((fp = fopen("01.day","rb")) == NULL)
{ printf("Error: Can't open 01.DAY !/n");
exit(0);
}
readrec(fp);
fclose(fp);
if(getch()==0) getch();
exit(0);
}
int readrec(FILE *fp)
{
float fn;
while (! feof(fp)) {
fread(&reco,sizeof(RECORD),1,fp);
printf("%10lu ",reco.date);
fn=float(reco.open)/1000;
printf("%8.2f ",fn);
fn=float(reco.high)/1000;
printf("%8.2f ",fn);
fn=float(reco.low)/1000;
printf("%8.2f ",fn);
fn=float(reco.close)/1000;
printf("%8.2f ",fn);
printf("%8lu ",reco.travl);
printf("%8lu/n",reco.traca);
}
printf("/n");
return 0;
}