Take the data of China Merchants Bank as an Example
// Stock. cpp: defines the entry point for the console application.
//
# Include "stdafx. H"
# Include <stdio. h>
# Include <conio. h>
# Include <stdlib. h>
Typedef struct
...{
Int date;
Int open;
Int high;
Int low;
Int close;
Int amount;
Int vol;
Int reservation;
} Stockdata;
Stockdata;
Int read_data (File *);
Void main ()
...{
File * FP;
If (FP = fopen ("E://vipdoc/SH/lday/sh600036.day", "rb") = NULL) // open the daily line of China Merchants Bank
... {Printf ("error: Can ^ t open sh600036.day! ");
Exit (0 );}
Read_data (FP );
Fclose (FP );
If (getch () = 0) getch ();
Exit (0 );
}
Int read_data (File * FP)
...{
Float FN;
While (! Feof (FP ))...{
Fread (& stockdata, sizeof (stockdata), 1, FP );
Printf ("% 10lu", stockdata. date );
Fn = float (stockdata. Open)/100;
Printf ("% 8.2f", FN );
Fn = float (stock data. High)/100;
Printf ("% 8.2f", FN );
Fn = float (stockdata. Low)/100;
Printf ("% 8.2f", FN );
Fn = float (stockdata. Close)/100;
Printf ("% 8.2f", FN );
Printf ("% 8lu", stockdata. amount );
Fn = float (stockdata. Vol)/100;
Printf ("% 8.2f", FN );
}
Printf ("");
Return 0;
}