Path: utzoo!attcan!uunet!know!zaphod.mps.ohio-state.edu!wuarchive!udel!mmdf From: AJB@dlvh.daresbury.ac.uk Newsgroups: comp.os.minix Subject: fopen() for update? Message-ID: <34240@nigel.ee.udel.edu> Date: 22 Oct 90 22:14:59 GMT Sender: mmdf@ee.udel.edu Lines: 27 I noticed in patching BISON for GNUC on the ST that the following code segment doesn't work on either the ACK or GNUC (or PC?) compilers. FILE *fp; char line[10]; fp = fopen("anyfile","w+"); fprintf(fp,"Hello\nWorld\n"); rewind(fp); fgets(line,10,fp); printf("%s",line); You definitely end up with a file containing the requisite text but the rewind doesn't work (which is not surprising looking at fopen.c) hence no 'Hello' is printed. To get bison to work I had to fclose(fp) and fopen() with "r" in place of the rewind(). BEWARE! the man pages I have says 'w+' is a valid option. Alan Bleasby SERC Daresbury Laboratory Daresbury Warrington UK Email: AJB@UK.AC.DARESBURY.DLVH