• Linux中调用 system的返回值


    先写一个被调用的函数

     

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

     

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


  • 相关阅读:
    ZOJ3213-Beautiful Meadow
    ZOJ3256-Tour in the Castle
    ZOJ3466-The Hive II
    hdu3377-Plan
    fzu1977-Pandora Adventure
    ural1519-Formula 1
    poj2914-Minimum Cut
    51nod-1220-约数之和
    51nod-1222-最小公倍数计数
    【html】【6】div浮动float
  • 原文地址:https://www.cnblogs.com/hjslovewcl/p/2314321.html
Copyright © 2020-2023  润新知