PAGE2GO2 HOME | INTERNET NEWS

LeighExchange - Free Advertising Network Stock Research at Internet Speed

Re: read and write binary file

 List
Subject: Re: read and write binary file
Poster: FlashGordonspam@flash-gordon.me.uk
Date: Fri, 23 Mar 2007 20:04:05 +0000
Related Postings: 1 2 3 4 5 6
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

 

Page2Go2.com is not responsible for content of this message.