Can't open / dev / console

//  console     = fopen("con",  "wt");       this worked under windows
//  console     = fopen("/dev/console",  "wt");     segmentation fault
    console     = fopen("/dev/tty0",  "wt");     returns zero

Writing to C using Mint Linux. I want to talk to the console regardless of the stdin and stdout redirection.

+4
source share
1 answer

The device is /dev/consolenot necessarily available to you. For Linux, this device will only show the result if you look at the current virtual terminal. Also (including Linux) most systems /dev/consolerequire elevated permissions to open it, for example, your application works like root. The reason for this is that some system messages are written to the system console.

For further discussion, here are a few links:

+1

All Articles