Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpmcaa!marco From: marco@hpmcaa.mcm.hp.com (Marco Dalla-Gasperina) Newsgroups: comp.sys.ibm.pc Subject: Re: Trouble readn' and writn' in C Message-ID: <9240006@hpmcaa.mcm.hp.com> Date: 22 Jun 89 15:34:10 GMT References: <3037@csd4.milw.wisc.edu> Organization: HP McMinville Division Lines: 18 ifp = fopen("file","a"); fwrite(&s,sizeof(s),1,ifp); fclose(ifp); ifp = fopen("file","r"); fread(&s,sizeof(s),1,ifp); ---------- You're problem might be that you're writing "binary" data but the files are opened in ASCII mode... this causes unwanted cr/lf <-> \n translations. try ifp = fopen("file","ab"); and ifp = fopen("file","rb"); marco