| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 743 人关注过本帖
标题:请教一个关于atexit( )函数的问题。
只看楼主 加入收藏
devfhpgah
Rank: 1
来 自:江西
等 级:新手上路
帖 子:204
专家分:0
注 册:2007-8-16
收藏
 问题点数:0 回复次数:0 
请教一个关于atexit( )函数的问题。
#include <stdio.h>
#include <stdlib.h>
void sign_off(void);
void too_bad(void);

int main(void)
{
    int n;
    atexit(sign_off);
    puts("Enter an integer:");
    if(scanf("%d",&n)!=1)
    {
       puts("That's no integer!");
       atexit(too_bad);
       exit(EXIT_FAILURE);
    }
    printf("%d is %s.\n",n,(n%2==0)?"even":"odd");
    system("pause");
    return 0;
}

void sign_off(void)
{
     puts("Thus terminates another magnificent program from");
     puts("SeeSaw Software!");
}

void too_bad(void)
{
     puts("SeeSaw software extends its heartfelt condolences");
     puts("to you upon the failure of your program.");
}

在IDE 中运行该程序时,可能看不到最后2行输出。

运行结果:
Enter an integer:
212
212 is even
Thus terminates another magnificent program from
SeeSaw Software!
我想请问一下,这里的“IDE”指的是什么意思呀!而我的就是看不到最后2行输出
搜索更多相关主题的帖子: atexit 函数 
2008-06-17 03:13
快速回复:请教一个关于atexit( )函数的问题。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021942 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved