简体   繁体   中英

How to stop a running program in C?

I have a problem.I've written a program in C for armbian.

I am using RTKLIB software for GPS data conversion from ubx to RTCM3 .

I get some data from serial port and start str2str (rtklib software).

It creates this command to run

str2str -in tcpsvr://:2101#ubx -out serial://ttyS2:115200#rtcm3 

and call system function to run this command. It is successful, but when I send a new command, I want it to stop the str2str software.

I've tried the exit(0) and it stops my software. I don't want to stop my software. I want to stop str2str and create a new command and run it again.

How can I do it? I am not good with the linux environment.

Thanks

I suggest you find out how to search for the str2str process you want to kill, and get the PID. A stackoverflow search will reveal this and then use the PID to kill the process. Unless RTKLIB has a process to do this directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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