lcdtest.c

来自「用于Linux 2.4内核的LCD及键盘驱动」· C语言 代码 · 共 26 行

C
26
字号
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>intmain (int argc, char **argv){  char str[100];  char *p;  int lcd_fd;  printf ("please enter the words(max char num:100):\n");  p = gets(str);  lcd_fd = open ("/dev/my_lcd", O_WRONLY | O_NDELAY);  if (lcd_fd == -1)    {      perror ("open");      exit (-1);    }  write (lcd_fd, p, strlen (p));  printf ("hello linux world\n");  close (lcd_fd);  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?