Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!uunet!zephyr.ens.tek.com!gvgpsa!gold.gvg.tek.com!shaunc From: shaunc@gold.gvg.tek.com (Shaun Case) Newsgroups: comp.lang.c Subject: Re: writing a file byte by byte Message-ID: <2011@gold.gvg.tek.com> Date: 28 Feb 91 21:08:37 GMT References: <9527@hub.ucsb.edu> Distribution: comp Organization: Grass Valley Group, Grass Valley, CA Lines: 21 In article <9527@hub.ucsb.edu> 6600bori@ucsbuxa.ucsb.edu (Boris Burtin) writes: >I'm using Turbo C 2.0 and DOS 3.3, and I'm attempting to write 8166 bytes >to a file (for those who know what I'm talking about, this is a MIDI sysex >file). By the MIDIEX standard, this file should be 8166 bytes long, but >when I write it, it turns out to be some 8300 or so bytes long. Does anyone >know how to solve this problem? Thanks... > It's hard to tell without having some code to look at, but I suggest two things: 1) make sure you have the file open in binary mode: fp = fopen(filename, "wb") 2) use fwrite() to write out the binary contents of a structure containing all the midi info. -- Shaun Case: shaunc@gold.gvg.tek.com or atman%ecst.csuchico.edu@RELAY.CS.NET or Shaun Case of 1:119/666.0 (Fidonet) or 1@9651 (WWIVnet) --- A bullet in the Bush is worth two in the hand.