简体   繁体   English

使用fopen写入嵌入式Linux的串行端口

[英]Writing to serial port embedded linux using fopen

Try writing to serial port embedded linux using fopen: 尝试使用fopen写入串行端口嵌入式Linux:

   void send(char * text) {
    FILE * output;
    output = fopen("/dev/ttyM0");
    if(output != NULL) {
      fputs(text, output);
      fclose(output);
    }

After about 4000 sends i get only null pointer. 大约4000次发送后,我仅得到空指针。 No ideas what's wrong. 不知道怎么了。

I would use the open system call. 我会使用开放系统调用。 fopen is Standard C Library call for buffered file IO. fopen是对缓冲文件IO的标准C库调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM