Skip to content

Instantly share code, notes, and snippets.

@johl
Created January 5, 2012 15:54
Show Gist options
  • Save johl/1565824 to your computer and use it in GitHub Desktop.
Save johl/1565824 to your computer and use it in GitHub Desktop.
f = fopen (filename, "ab"); /* reopen in binary append mode */
for (y = height - 1; y >= 0; y--)
{
for (x = 0; x < width; x++)
{
i = (y * width + x) * 4;
printf ("i is now: %i\n", i);
if (ptr != 0)
{
fputc (ptr[i + 2], f); /* write blue */
fputc (ptr[i + 1], f); /* write green */
fputc (ptr[i], f); /* write red */
}
}
}
fclose (f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment