Re: Changing the active console

Jim Meyering (asethman@mandate-inc.com)
Tue, 16 Feb 1999 09:39:42 -0500 (EST)


On Tue, 16 Feb 1999, Roberto Fasciolo wrote:

> Hi.
>
> I'd like to know if it's possible changing the active console (the same
> thing that pressing CTRL+ALT+Fx) with a system call, and, if it's
> possible, how can I do that.
>

Well it might not exactly be a system call...but its an ioctl()...
It would generally go something like...

#include <sys/ioctl.h>
#include <linux/vt.h>

int main(char *argv, int argc)
{
int fd;
open("/dev/tty", O_RDONLY);
/* 3 is the VT you wish to switch to */
ioctl(fd, VT_ACTIVATE, 3);
close(fd);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/