通过tty执行命令 [英] Execute the command via tty

查看:107
本文介绍了通过tty执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是linux c编程的新手,我需要编写一个关于如何通过串口执行命令的C程序逻辑电脑到另一台电脑



例如: -



我有两台PC通过USB连接到串行电缆。我需要执行以下命令: -

hi all,

I am new to linux c programming, i need to write a C program logic on how to execute a command through a serial port from one pc to another pc

For example:-

I am having a two PC connected via usb to serial cable. I need to execute the command for eg;-

ls

将文件列在另一台计算机上,通过USB转串口。



但是当我试图写一个命令它收到的是一个普通字符串而不是一个命令时,任何人都可以告诉我如何在c程序的帮助下通过/ dev / ttyUSB从一台电脑到另一台电脑执行终端命令< br $>






谢谢

shan

to list the file in another computer via usb to serial.

But when i tried to write a command it received as a plain string not a command, can any one tell me how do i execute the terminal command from one pc to another pc via /dev/ttyUSB with the help of c program



Thanks
shan

推荐答案

您必须通过目标机器上的C代码执行命令,检索信息,然后通过串口将其发送回原始计算机。

系统 [ ^ ]函数可能会有所帮助。
You will have to execute the command via the C code on the target machine, retrieve the information, and send it back to the original computer via the serial port.
The system[^] function will probably help.


这篇关于通过tty执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆