You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <stdio.h>
# include <stdlib.h>
# define SIZE 50
void browse ( ) {
system ( " cls " ) ;
struct TX {
char name [ 10 ] ;
char jiguan [ 20 ] ;
char d1 [ 20 ] ;
char d2 [ 20 ] ;
char ema [ 30 ] ;
} inf [ SIZE ] ;
FILE * fp ; int i = 0 ;
fp = fopen ( " date.dat " , " rb " ) ; //打开二进制文件进行只读;
printf ( " \t \t \t **************************************************************** \n " ) ;
printf ( " \t \t \t ***** 信息列表 ***** \n " ) ;
printf ( " \t \t \t *****------------------------------------------------------***** \n " ) ;
for ( i = 0 ; fread ( & inf [ i ] , sizeof ( struct TX ) , 1 , fp ) = = 1 ; i + + ) { //从二进制文件中读出信息。若fread(&inf[i],sizeof(struct TX),1,fp)! =1代表文件到末尾。
printf ( " \t \t \t *****姓名:%s \n " , inf [ i ] . name ) ;
printf ( " \t \t \t *****籍贯:%s \n " , inf [ i ] . jiguan ) ;
printf ( " \t \t \t *****电话号码1: %s \n " , inf [ i ] . d1 ) ;
printf ( " \t \t \t *****电话号码2: %s \n " , inf [ i ] . d2 ) ;
printf ( " \t \t \t *****邮箱:%s \n \n \n \n " , inf [ i ] . ema ) ;
} printf ( " \n \n \n " ) ;
fclose ( fp ) ;
}