Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!CS.BROWN.EDU!jb From: jb@CS.BROWN.EDU Newsgroups: comp.sys.encore Subject: Re: File buffers Message-ID: <8808031913.AA06146@tracy.cs.brown.edu> Date: 3 Aug 88 19:13:16 GMT References: <585@cmx.npac.syr.edu> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 17 I'm not exactly sure how things are behaving, but I'd guess that the problem is that while the buffer was shared, the file pointer was not shared. To fix this problem, after you do the fopen(), copy the entire file pointer (FILE *) into a new copy in a block of shared memory. Set the buffer by patching the copied structure to be in shared memory as well. (Copying after the setbuf call would probably work as well.) Use this new file pointer instead of the one returned by fopen for all subsequent i/o. Don't forget that this is a shared data structure and that mutual exclusion is needed around calls to fprintf and fscanf (or any other routines in stdio). This hack should work, but is totally nonstandard. It assumes some knowledge of how stdio works and is outside what is docummented. Use at your own risk. Jim