Skip to content

Instantly share code, notes, and snippets.

@dennda
Created October 5, 2011 19:23
Show Gist options
  • Save dennda/1265395 to your computer and use it in GitHub Desktop.
Save dennda/1265395 to your computer and use it in GitHub Desktop.
FILE *fp = fopen("/Users/dennda/Desktop/binary.buf", "wb");
size_t count;
if(fp == NULL) {
printf("failed to open sample.txt\n");
assert(0);
}
count = fwrite((const char*) imgData, sizeof(unsigned short), width*height, fp);
printf("Wrote %zu bytes. fclose(fp) %s.\n", width*height, fclose(fp) == 0 ? "succeeded" : "failed");
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment