#include <stdio.h>
#include <string.h>
int main( void )
{
FILE *stream;
typedef struct _tt{
int a;
int b;
char buf[20];
}tt;
tt temp;
temp.a=10;
temp.b=20;
strcpy(temp.buf,"hello");
int c=sizeof(temp);
stream= fopen("at.dat","w+");
fwrite(&temp,sizeof(temp),1,stream);
char *pbuf=new char[sizeof(temp)];
fseek(stream,0,SEEK_SET);
fread(pbuf,sizeof(temp),1,stream);
fclose(stream);
tt *p=(tt*)pbuf;
printf("%d %d %s",p->a,p->b,p->buf);
}