📄 adc_test.c
字号:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
int main(){
int fd, size;
char s[] = "1234";
char buf[10];
//buf = (char *)malloc(sizeof(s));
//memset( buf, 0, sizeof(s));
//while ( 1 ){
fd = open( "/dev/adc", O_WRONLY );
if ( fd < 0 ){
printf( "open file fail\n" );
return -1;
}
//while ( 1 ){
write( fd, s, sizeof( s ) );
//}
close( fd );
fd = open( "/dev/adc", O_RDONLY );
//while ( 1 ){
size = read( fd, buf, sizeof(s) );
//}
close( fd );
//free( buf );
//printf( "buf = %s\n", buf );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -