[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overwriting binary Files

From: Mike Miller
Subject: Re: Overwriting binary Files
Date: Tue, 16 Aug 2016 08:20:55 -0700
User-agent: Mutt/1.6.2-neo (2016-07-23)

On Tue, Aug 16, 2016 at 06:40:24 -0700, Arym wrote:
> Hello everybody,
> I have some binary files I would like to change, but the only thing I want
> to change is 1 byte out of 28k for instance.
> pointer = ftell(openFile);
> oldValue = fread(openFile,1,'int16','ieee-le');
> newValue= 0x00FF ;
> fseek(openFile,pointer);
> fwrite(openFile,type);

Your example is confusing.

* You say you want to change one byte, but you are reading an int16,
  assigning the variable "newValue" as a double, then writing a uchar
* What does the name "type" refer to? Did you mean "newValue" instead?
* Is "openFile" an ordinary seekable file stream opened with mode "r+b"?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]