26 lines
478 B
C
26 lines
478 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<string.h>
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
|
||
|
int found = 0;
|
||
|
FILE* flux = fopen("rgb.txt", "r");
|
||
|
|
||
|
int r, g, b;
|
||
|
char name[100];
|
||
|
|
||
|
while (!feof(flux)) {
|
||
|
fscanf(flux, "%d %d %d\t\t%99[^\n]", &r, &g, &b, &name);
|
||
|
if (strcmp(name, argv[1]) == 0) {
|
||
|
found++;
|
||
|
printf("Color found : \x1B[38;2;%d;%d;%dm%d, %d, %d\x1B[37m.\n", r, g, b, r, g, b, name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!found) puts("No color found...");
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|