help-octave
[Top][All Lists]
Advanced

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

Overwriting binary Files


From: Arym
Subject: Overwriting binary Files
Date: Tue, 16 Aug 2016 06:40:24 -0700 (PDT)

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);

So the idea is reading the value and depending on the value itself, change
it afterwards. I would like to do this without creating a new file. Would be
this possible with the current fwrite(...) or other function I haven't
figured out yet because so far it seems that what it happens when I run the
code above is that I write this newValue just before the oldValue without
removing the oldValue.

It is pretty possible this cannot be done so even if you thing this cannot
be done confirm it please.

Thanks in advance,
Regards





--
View this message in context: 
http://octave.1599824.n4.nabble.com/Overwriting-binary-Files-tp4679251.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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