Skip to content

Instantly share code, notes, and snippets.

@vtols
Created January 28, 2013 17:16
Show Gist options
  • Save vtols/4657294 to your computer and use it in GitHub Desktop.
Save vtols/4657294 to your computer and use it in GitHub Desktop.
#include <unistd.h>
#include <stdio.h>
int main()
{
if (isatty(fileno(stdout)))
printf("\e[1mIn terminal\e[0m\n");
else
printf("In file or pipe\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment