Skip to content

Instantly share code, notes, and snippets.

@DSchougaard
Created September 27, 2011 15:08
Show Gist options
  • Save DSchougaard/1245307 to your computer and use it in GitHub Desktop.
Save DSchougaard/1245307 to your computer and use it in GitHub Desktop.
while( readingFile == 1 ){
fread(&holdByte1, sizeof(holdByte1), 1, fp);
if( holdByte1 == 0 ){
fread(&holdByte2, sizeof(holdByte2), 1, fp);
if( holdByte2 == 0 ){
linecount++;
}else if( holdByte2 == 1 ){
readingFile = 0;
}else if( holdByte2 == 2){
printf("Delta");
}else if( holdByte2 > 3 ){
loopVal = holdByte2;
for( j = 0; j < loopVal; j++ ){
fread(&holdByte3, sizeof(holdByte3), 1, fp);
image->Pixels[i] = holdByte3;
i++;
printf("%d\n", i);
}
fread(&junk, sizeof(junk), 1, fp);
}
}else{
numberByte = holdByte1;
fread(&valueByte, sizeof(valueByte), 1, fp);
for( j = 0; j < numberByte; j++){
image->Pixels[i] = valueByte;
i++;
printf("%d\n", i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment