heres what i know about the gif files:
1 - the 0x2C(',') is the Image Separator;
2 - the 0X3B(';') is the Image Terminator and the Trailler.
knowing that, i did these loop for read the gif file\stream byte a byte:
friend std::istream& operator >> (std::istream& lhs, image& rhs)
{
DebugText("reading....");
int streamsize=0;
char *p=newchar[1];
vector <char> chrStream;
while(true)
{
staticbool blnStarted=false;
lhs.read(reinterpret_cast<char*>(p),1);
if(p[0]=='G' && blnStarted==false)//testing if is the start of file
{
blnStarted=true;
chrStream.resize(1);
chrStream[0]='G';
}
elseif(p[0]==',' && blnStarted==false) //testing if is the end of GIF file
{
chrStream.resize(chrStream.size()+1);
chrStream[chrStream.size()-1]=',';
blnStarted=true;
}
elseif(p[0]!=',' && blnStarted==false) //testing if is the end of GIF file
{
break;
}
elseif(p[0]==';' && blnStarted==true) //testing if is the end of GIF file
{
chrStream.resize(chrStream.size()+1);
chrStream[chrStream.size()-1]=';';
blnStarted=false;
}
else //saving the file stream on vector
{
chrStream.resize(chrStream.size()+1);
chrStream[chrStream.size()-1]=p[0];
}
}
streamsize=chrStream.size();