先写一个被调用的函数

 

==================================
编译后生成一个"rt"的可执行文件
运行结果
==================================
Return 10.
==================================
再写一个调用system的程序
==================================

 

==================================
编译后运行结果
==================================
Return 10.
wifexited(status):1
WEXITSTATUS(status):10
cp exit normal![0]
exit staus = [A]
==================================
可以看到:
WEXITSTATUS(status)可以得到调用程序的返回值。


相关文章:

  • 2022-12-23
  • 2021-10-26
  • 2021-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-09
  • 2022-01-05
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案