writing a file byte by byte

Shaun Case shaunc at gold.gvg.tek.com
Fri Mar 1 08:08:37 AEST 1991


In article <9527 at hub.ucsb.edu> 6600bori at 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 at gold.gvg.tek.com  or  atman%ecst.csuchico.edu at RELAY.CS.NET 
 or Shaun Case of 1:119/666.0 (Fidonet)  or  1 at 9651 (WWIVnet)
---
A bullet in the Bush is worth two in the hand.



More information about the Comp.lang.c mailing list