Created
December 5, 2014 03:59
-
-
Save mikequentel/e32acc62b3ae5e330558 to your computer and use it in GitHub Desktop.
How to Create a Text File List of RGB Values in C http://mikequentelsoftware.blogspot.ca/2010/11/how-to-create-text-file-of-rgb-values.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
FILE *fp; | |
fp = fopen("true_colour.txt", "w"); | |
int r = 255; | |
int g = 255; | |
int b = 255; | |
for (r = 255; r >= 0; r--) { | |
for (g = 255; g >= 0; g--) { | |
for (b = 255; b >= 0; b--) { | |
fprintf(fp, "%d", r); | |
fprintf(fp, ","); | |
fprintf(fp, "%d", g); | |
fprintf(fp, ","); | |
fprintf(fp, "%d", b); | |
fprintf(fp, "\n"); | |
} | |
} | |
} | |
fclose(fp); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment