Ulrich Eckhardt wrote, On 23/03/07 16:13:
> ericunfuk wrote:
>> I want to read a binary file(it's pic.tif file, I guess it's binary
>> file?), then write it to a new file)
>
> In general, all files are binary.
Not as far as C is concerned.
> There are some OSs that have special
> textfiles, where the system transparently translates lineendings.
There can be other differences as well, and this is why C makes a clear
distinction. You should therefore always open the file in the correct
mode unless you have a very good reason not to.
> As far
> as C is concerned, there is also the distinction between using e.g.
> fprintf() which does formatting (as text) before writing and fwrite, which
> takes preformatted data.
C does not make that distinction. C allows you to use fprintf on a
binary stream and fwrite on a text stream.
>> I'm very new to C so your help is much appreciated.
>
> Get a good book, check out the reviews at ACCU's website.
Search the archives of this group and you will find references.
--
Flash Gordon