怎样用C语言调用程序API

如题所述

第1个回答  2019-10-03
程序依靠调用外部shutdown实现关机。本例中定时100秒。
将100改为0,实现立即关机。
方法一:
#include

#include

void
main(void)
{
system("shutdown.exe
-s
-t
100");
getch();
system("shutdown.exe
-a");
}
方法二:
打开txt文档,输入
shutdown
-s
-t
100
保存。将文件扩展名保存为.bat。
第2个回答  2019-06-23
#include
<windows.h>这样就可以条用api文件了;如果只是关机的话下面的代码你可以试试
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
void
main()
{
char
shut[8];
char
b[81];
printf("Hello,
Welcome
to
the
TC
automatic
shutdown
procedures\n");
printf("
Watermelon
production\n");
printf("Please
enter
your
desired
automatic
shutdown
of
time:");
scanf("%s",shut);
sprintf(b,"at
%s
shutdown
-s",shut);
system(b);
}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网