C code - ls system command not showing bash colors
- by m0atz
I've just been fooling around with some code in C, an example of a really basic program is as follows which just, obviously, lists the directories using the ls system command.
#include <stdio.h>
int main (void) {
system("ls -l -d */");
printf("I've just listed the directories :-)\n");
return 0;
}
This runs fine, but it shows the ls output in monochrome, whereas Bash would output the list using colors for the directories (or files if I included files). How can I make my C code use the bash colors? Thanks