app.c

来自「Epson BA-T500USB在Linux 2.4下的设备驱动」· C语言 代码 · 共 32 行

C
32
字号
//app.c for t500usb USB module testing#include <stdio.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <linux/types.h>#include <string.h>int main(int argc, char* argv[]){	char* str;	int i, j;				int fd = open("/dev/usb/t500usb", O_RDWR);	if(fd == -1)	{		printf("Open BA-T500USB port failed!\n");		return -1;	}	        str = "a123456789b123456789\x0a c123456789d123456789\x0a e123456789f123456789\x0a g123456789\x0a";	j = write(fd, str, strlen(str));		//if str include "\x0", you should use like this: write(fd, str, 77);	printf("%d=%s", j, str);	close(fd);}

⌨️ 快捷键说明

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