About the method of using the system function in C language

Source: Internet
Author: User

Definition of System I didn't take a closer look, mainly on the execution system command, say the system command, is the command prompt under Windows can execute the command, and corresponds to the terminal name command under Unix/linux;

Example 1;

1 int Main () 2 {3     System ("pause"); 4     System ("dir"); 5     return 0 ; 6 }

As you can see, the result is:

Do not include any header files;

common commands are; (under Windows)

Pause: Suspend execution, commonly used in C + + under the VS write-down at the end of the program to avoid flash;

CLS: Clear screen, that is, clearing the console, the usage can be:

First on the code:

1printf"\t****************************************************\n");2printf"\t* *\n");3printf"\t* 1-SDSDSDSDSD 2-dsadass *\n");4printf"\t* 3-SDSADSADSD 0-hleks *\n");5printf"\t* *\n");6printf"\t****************************************************\n");7 8     intI=0;9scanf"%d",&i);Ten GetChar (); One     if(i==1) A     { -System"CLS"); -}

, if you enter 2

The result is this:

Enter 1, after the CLS is executed:

Other useful words I will record again;

Finished

About the method of using the system function in C language

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.