Xref: utzoo comp.sys.ibm.pc.programmer:460 comp.sys.ibm.pc:46693 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!shelby!neon!Neon.Stanford.EDU!minakami From: minakami@Neon.Stanford.EDU (Michael K. Minakami) Newsgroups: comp.sys.ibm.pc.programmer,comp.sys.ibm.pc Subject: File buffer trashing data? Message-ID: <1990Mar19.054020.13581@Neon.Stanford.EDU> Date: 19 Mar 90 05:40:20 GMT Sender: minakami@Neon.Stanford.EDU (Michael K. Minakami) Organization: Computer Science Department, Stanford University Lines: 12 I'm trying to debug a program and came across something unusal: fwrite() is changing the contents of an array. The array has memory calloc'ed for it at the beginning of the program, and when fwrite() is called it trashes everything started at array+4. I dereferenced the file pointer and found a variable (blk?) that was pointing to that location. Also tracing through fwrite, the array was being changed by a memcpy which (surprise) copied the data I wanted to fwrite over the array. Does anyone know what's going on? Thanks Michael