musray
V2EX  ›  问与答

在terminal中运行简单c语言程序出现死循环,如何中断?

  •  
  •   musray · Apr 2, 2012 · 8696 views
    This topic created in 5180 days ago, the information mentioned may be changed or developed.
    简单操作过程:
    Lion中,用terminal执行gcc编译写好的c程序,然后执行./a.out

    因为code写成了死循环,于是程序一直输出printf中的内容。

    这时候除了直接关闭terminal外,有没有什么方法中断程序执行?
    7 replies    1970-01-01 08:00:00 +08:00
    X_Del
        1
    X_Del  
       Apr 2, 2012
    Ctrl + C
    bruce
        2
    bruce  
       Apr 2, 2012 via Android
    ctrl c
    musray
        3
    musray  
    OP
       Apr 2, 2012
    @bruce @X_Del 受教了
    laskuma
        4
    laskuma  
       Apr 2, 2012
    @bruce @X_Del @musray 被抢先了吗。。。
    MartianZ
        5
    MartianZ  
       Apr 2, 2012
    被抢先了,呵呵
    Livid
        6
    Livid  
    MOD
    PRO
       Apr 2, 2012
    ps ax 找到 pid

    然后 kill -KILL pid
    tuoxie007
        7
    tuoxie007  
       Apr 2, 2012
    ctrl \
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3119 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 13:31 · PVG 21:31 · LAX 06:31 · JFK 09:31
    ♥ Do have faith in what you're doing.