C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading and Writing GIF files

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
masud
Guest





PostPosted: Wed Jul 30, 2003 10:29 am    Post subject: Reading and Writing GIF files Reply with quote




Hi!
I want to know how to read a GIF file in binary mode so that i can
seperately read each byte and alter it if i want to. After alteration
of any bit, i want to write the whole GIF file again in a new file as
it is. I am working on the Linux platform. Any help in this regard
would be highly appreciated.
Thankyou.
Masud.

--
Posted via http://dbforums.com
Back to top
Allan Bruce
Guest





PostPosted: Wed Jul 30, 2003 10:47 am    Post subject: Re: Reading and Writing GIF files Reply with quote




"masud" <member34557 (AT) dbforums (DOT) com> wrote

Quote:

Hi!
I want to know how to read a GIF file in binary mode so that i can
seperately read each byte and alter it if i want to. After alteration
of any bit, i want to write the whole GIF file again in a new file as
it is. I am working on the Linux platform. Any help in this regard
would be highly appreciated.
Thankyou.
Masud.

--
Posted via http://dbforums.com

This is not easy to do.
The only on-topic part of this is reading the file in binary mode, but this
is the least of your worries. Check http://www.wotsit.org/ to see how to
encode/decode the GIF file format.
Allan



Back to top
Chris Theis
Guest





PostPosted: Wed Jul 30, 2003 11:09 am    Post subject: Re: Reading and Writing GIF files Reply with quote




"masud" <member34557 (AT) dbforums (DOT) com> wrote

Quote:

Hi!
I want to know how to read a GIF file in binary mode so that i can
seperately read each byte and alter it if i want to. After alteration
of any bit, i want to write the whole GIF file again in a new file as
it is. I am working on the Linux platform. Any help in this regard
would be highly appreciated.
Thankyou.
Masud.


This approach is not limited to GIF files but to any binary file. Just open
the file in binary mode and use the read method.
For example:

std::ifstream is( "myfile.gif", ios::binary );
char Data;

if( !is ) {
cerr << "Can't open input file" << endl;
return false;
}

while( is.read( (char*) &Data, sizeof(char) ) ) {
// ... do something
}

To write the a file in binary mode just check out the write method of
ofstream.

HTH
Chris



Back to top
Carl Muller
Guest





PostPosted: Thu Jul 31, 2003 1:42 pm    Post subject: Re: Reading and Writing GIF files Reply with quote

masud <member34557 (AT) dbforums (DOT) com> wrote

Quote:
Hi!
I want to know how to read a GIF file in binary mode so that i can
seperately read each byte and alter it if i want to. After alteration
of any bit, i want to write the whole GIF file again in a new file as
it is. I am working on the Linux platform. Any help in this regard
would be highly appreciated.
Thankyou.
Masud.

Hi, that depends on where you reside, and where the program will be
used. If you live or work in Canada, France, Italy, Germany, the
United Kingdom, or Japan, GIF files are still patented so it is
illegal to read or write them without permission from Unisys. If you
are in the USA, the patent expired 20 June 2003. (
http://burnallgifs.org/ ) The rest is a simple matter of coding :-)

This has brought new meaning to "illegal expressions" within C++... At
least the ^ (xor) operator is still legal despite some people's
efforts.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.