Check NumLock status

Have anybody an Idea or Script, how i can check NumLock status? I have only found a way to set Numlock status on this page. But I want only to check the status of Numlock.(not change)

Thanks.

Have a look at the last post in this thread (there is some code to get CAPS_LOCK status, perhaps this helps):
openqnx.com/PNphpBB2-viewtopic-t5060-.html

However I don’t know whether this (as the site you posted earlier) works on QNX4.

I have seen, the stty tool show as output the numlock status. But I dont know, how I can extract the result from numlock status to a var.

try this:

[code]/* For “devctl()” */
#include <devctl.h>
#include <sys/dcmd_chr.h>

/* For “open()” */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

/* For Errors */
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

int main(void)
{
int fd = open( “/dev/kbd”, O_RDONLY);
int data = 0;

if( -1 != fd)
{
    if( EOK == devctl( fd, DCMD_CHR_LINESTATUS, &data, sizeof( data), NULL))
    {
        printf( "Scroll Lock is ");
        if(data & _LINESTATUS_CON_SCROLL)   printf("on\n");
        else                                printf("off\n");
        printf( "Num Lock is ");
        if(data & _LINESTATUS_CON_NUM)      printf("on\n");
        else                                printf("off\n");
        printf( "Caps Lock is ");
        if(data & _LINESTATUS_CON_CAPS)     printf("on\n");
        else                                printf("off\n");
        printf( "Shift is ");
        if(data & _LINESTATUS_CON_SHIFT)    printf("on\n");
        else                                printf("off\n");
        printf( "Ctrl is ");
        if(data & _LINESTATUS_CON_CTRL)     printf("on\n");
        else                                printf("off\n");
        printf( "Alt is ");
        if(data & _LINESTATUS_CON_ALT)      printf("on\n");
        else                                printf("off\n");
    }
    else
    {
        perror("devctl");
    }
}
else
{
    perror("open");
}

return(0);

}[/code]

Thanks! I will try this.

Edit: @RoverFan Its only for QNX6.