To find out whether the current terminal is a VC, you can open /dev/tty and use VT_GETMODE to query the mode:
struct vt_mode vtmode; fd = open("/dev/tty", O_RDWR); retval = ioctl(fd, VT_GETMODE, &vtmode); if (retval < 0) { /* This terminal is not a VC; take appropriate action */ }