简体   繁体   English

在C程序中,使用Picocom读取/写入流

[英]Within C program use Picocom to read/write streams

I am thinking of creating a C program that will use picocom to read and write serial streams to ports (GPS module, NTPD). 我正在考虑创建一个C程序,它将使用picocom来读取和写入端口(GPS模块,NTPD)的串行流。 The c program will run on a Debian OS. c程序将在Debian OS上运行。

Is it possible to do this using Picocom? 是否可以使用Picocom做到这一点? Is it bad design to interact with Picocom through c and system commands? 通过c和系统命令与Picocom进行交互的设计不好吗?

While that's technically possible, it's a bad idea; 尽管从技术上讲这是可能的,但这是一个坏主意; picocom is a somewhat uncommon tool, and it's primarily designed to be used interactively by a user. picocom是一种不太常见的工具,其主要设计目的是供用户交互使用。 Trying to use it from within another application will be pretty weird. 尝试从另一个应用程序中使用它会很奇怪。

It'll be much easier to interact with the serial port directly from your application. 直接从您的应用程序与串行端口进行交互会容易得多。 There's a nice introduction to doing that in the answer to How to open, read, and write from serial port in C . 如何从C中的串行端口打开,读取和写入的答案中,有一个很好的介绍。

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

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