精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 電腦安全 > 系統(tǒng)安全 > c語言調(diào)用系統(tǒng)命令

      c語言調(diào)用系統(tǒng)命令

      時(shí)間: 黎正888 分享

      c語言調(diào)用系統(tǒng)命令

        很多初學(xué)C語言的朋友在學(xué)習(xí)了一些簡(jiǎn)單的語法操作之后都想試一下如何運(yùn)用C語言來操作電腦,學(xué)習(xí)啦小編就教大家一些C語言調(diào)用系統(tǒng)命令,希望能幫助到大家對(duì)于C語言的學(xué)習(xí)。

        C語言調(diào)用系統(tǒng)命令:

        1、首先我們進(jìn)入編程軟件,輸入c語言基本框架,如下:

        #include <stdio.h>

        int main(int argc, char *argv[])

        {

        return 0;

        }

        2、現(xiàn)在我們就來使用system("");函數(shù)來進(jìn)行dos命令的執(zhí)行吧。我們只需要將需要執(zhí)行的命令放入函數(shù)的“”中就ok啦!比如我們調(diào)用系統(tǒng)時(shí)間,在引號(hào)中輸入time命令,如下:

        #include <stdio.h>

        int main(int argc, char *argv[])

        {

        system("time");

        return 0;

        }

        這里我們點(diǎn)擊編譯后會(huì)發(fā)現(xiàn)有錯(cuò)誤,為什呢??

        3、原來是我們忘記添加頭文件#include<stdlib.h>了,因?yàn)檎{(diào)用dos命令的函數(shù)在頭文件#include<stdlib.h>中,所以如果c語言調(diào)用dos命令的話,記得加上#include<stdlib.h>哦。

        4、現(xiàn)在我們的代碼變成這樣了:

        #include <stdio.h>

        #include<stdlib.h>

        int main(int argc, char *argv[])

        {

        system("time");

        return 0;

        }

        點(diǎn)擊編譯運(yùn)行,正常顯示系統(tǒng)時(shí)間,如下圖。很簡(jiǎn)單吧!趕緊試試吧!

      1665759