#include #include #include #include /* reads from the device. Especified the number of characters * to be read from the device. Its just a dummy program!!! */ int main(int argc, char * argv[]){ int fd,ret; char * buf; if(argc != 2) { printf("usage %s \n",argv[0]); return 0; } if((fd = open("/dev/lcd", O_RDWR)) < -1) { perror("file files\n"); return 0; } if((buf = malloc(atoi(argv[1])))==NULL){ printf("malloc failed\n"); return 0; } if( (ret = read(fd,buf,atoi(argv[1]))) < 0){ perror("read"); return 0; } printf("Read %d characters\n",ret); printf("\n%s\n",buf); return 0; }