Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!uflorida!kluge!serss0!id8rld06 From: id8rld06@serss0.fiu.edu (Michael N Johnston) Newsgroups: comp.lang.c Subject: Re: Trouble spot! Message-ID: <3320@kluge.fiu.edu> Date: 14 Apr 91 15:45:57 GMT References: <1991Apr11.201116.28143@lynx.CS.ORST.EDU> Sender: news@kluge.fiu.edu Distribution: usa Organization: Florida International University, Miami Lines: 42 ] void find() ] { ] [...] ] if((fptr=fopen("maillist.txt","r"))==NULL) { ] [...] ] fscanf(fptr,"%s %s %s %s %d", addr_info[t].name, addr_info[t].street, addr_info[t].city, addr_info[t].state, addr_info[t].zip); ] [...] ] } Notice that here in find(), you are opening the file for read and doing FORMATTED input. ] void save() ] { ] [...] ] if((fp=fopen("maillist.txt","wb"))==NULL) { ] [...] ] if(fwrite(&addr_info[i],sizeof(struct addr),1,fp)!=1) ] [...] ] } But here in save(), you are opening the file for write in BINARY mode and doing UNFORMATTED output. You need to change the open and read in find() to unformated, binary input as you have below in load(). ] void load() ] { ] [...] ] if((fp=fopen("maillist.txt","rb"))==NULL) { ] [...] ] if(fread(&addr_info[i],sizeof(struct addr),1,fp)!=1) { ] [...] ] } Mike -- ==================================================================== Michael Johnston id8rld06@serss0.fiu.edu or 26793271x@servax.fiu.edu