📄 test.c
字号:
/* * Buttos Example for Matrix IV * * Copyright (C) 2004 capbily - friendly-arm * capbily@hotmail.com */#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <errno.h>#include "weida_printer.h"int main(void){ int weida_fd, ret,length; char *data="hello,welcome to embedded world!"; char buff[100]; weida_fd = open("/dev/weida_printer", O_WRONLY); if (weida_fd < 0) { perror("open device buttons"); exit(1); } //printf("data len: %d\n, string is %s\n",strlen(data), data); ret = write(weida_fd, data, strlen(data)); if (ret != strlen(data)) { perror("print worng\n"); } scanf("%s",&buff); length=strlen(buff); buff[length]='\0'; ret = write(weida_fd, buff, strlen(buff)); if (ret != strlen(buff)) { perror("print worng\n"); } /*ioctl(weida_fd, WEIDA_IOCSFONTSPACE, 1); printf("1\n"); ioctl(weida_fd, WEIDA_IOCSLINESPACE, 1); printf("2\n"); sleep(1); ret = write(weida_fd, data, strlen(data)); printf("3\n");*/ if (ret != strlen(data)) { perror("print worng\n"); } close(weida_fd); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -