What is the c++ clear screen function?

青灯夜游
Release: 2022-12-30 11:12:01
Original
18604 people have browsed it

c The screen clearing function is "system("cls")". system() is a C/C function, its function is to issue a DOS command; when the parameter of the function is "cls", it means using the cls command on DOS, and its function is to "clear the screen", that is, to clear all screen display information .

What is the c++ clear screen function?

The operating environment of this tutorial: Windows 7 system, C 17 version, Dell G3 computer.

Related recommendations: C language video tutorial, C video tutorial

c The screen clearing function is "system(" cls")", execute the console command cls, the function is to clear the screen and clear all screen display information.

system is a C/C function. The detailed explanation of the system () function under the Windows operating system is mainly applied in C language. The system function needs to be added with the header file before it can be called.

Function: Issue a DOS command

Usage:int system(char *command);

system function has been included in standard c In the library, you can directly call the

program example:

#include <stdlib.h>
#include <stdio.h>
int main(void)
{
  printf("About to spawn command.com and run a DOS command\n");
  system("dir");
  return 0;
}
Copy after login

Another example: system("pause") can freeze the screen to facilitate observing the execution results of the program; system("CLS") can Implement screen clearing operation. Calling the color function can change the foreground color and background of the console.

The commonly used DOS commands are listed below, all of which can be called with the system function:

  • ASSOC Display or modify file extension associations.

  • AT Commands and programs scheduled to be run on a computer.

  • ATTRIB Display or change file attributes.

  • BREAK Set or clear the extended CTRL C check.

  • CACLS Display or modify the access control lists (ACLs) of files.

  • CALL Call this one from another batch program.

  • CD Display the name of the current directory or change it.

  • CHCP Display or set the number of active code pages.

  • CHDIR Displays the name of the current directory or changes it.

  • CHKDSK Checks the disk and displays a status report.

  • CHKNTFS Display or modify the startup time disk check.

  • CLS Clear the screen.

  • CMD Open another Windows Command Shell window.

  • COLOR Set the default console foreground and background colors.

  • COMP Compares the contents of two or two sets of files.

  • COMPACT Displays or changes the compression of files on NTFS partitions.

  • CONVERT Converts a FAT volume to NTFS. You cannot convert the current drive.

  • COPY Copy at least one file to another location.

  • DATE Display or set the date.

  • DEL Delete at least one file.

  • DIR Displays files and subdirectories in a directory.

  • DISKCOMP Compares the contents of two floppy disks.

  • DISKCOPY Copies the contents of one floppy disk to another floppy disk.

  • DOSKEY Edit the command line, invoke Windows commands and create macros.

  • ECHO Display a message, or turn command echo on or off.

  • ENDLOCAL Ends localization of environment changes in the batch file.

  • ERASE Delete at least one file.

  • EXIT Exit the CMD.EXE program (command interpreter).

  • FC Compare two or two sets of files and display the differences.

  • FIND Search for a text string in a file.

  • FINDSTR Search for a string in a file.

  • FOR Runs a specified command for each file in a set of files

  • FORMAT Format the disk for use with Windows.

  • FTYPE Displays or modifies the file type used for file extension association.

  • GOTO Points the Windows command interpreter to a specified line in the batch program.

  • GRAFTABL Enables Windows to display the extended character set in image mode.

  • HELP Provides help information for Windows commands.

  • IF Execute conditional processing in the batch program.

  • LABEL Create, change or delete the volume label of the disk.

  • MD Create a directory.

  • MKDIR Create a directory.

  • MODE Configure system equipment.

  • MORE Displays one results screen at a time.

  • MOVE Move files from one directory to another.

  • PATH Display or set the search path for executable files.

  • PAUSE Pauses batch file processing and displays a message.

  • POPD Restore the previous value of the current directory saved by PUSHD.

  • PRINT Print text file.

  • PROMPT Change the Windows command prompt.

  • PUSHD Save the current directory and then make changes to it.

  • RD Delete the directory.

  • RECOVER Recovers readable information from problematic disks.

  • REM Record comments in batch files or CONFIG.SYS.

  • REN Rename the file.

  • RENAME Rename the file.

  • REPLACE Replace the file.

  • RMDIR Delete directory.

  • SET Display, set, or delete Windows environment variables.

  • SETLOCAL Starts localization of environment changes in a batch file.

  • SHIFT Change the position of replaceable parameters in the batch file.

  • SORT Classifies the input.

  • START Start another window to run the specified program or command.

  • SUBST Associates a path with a drive letter.

  • TIME Display or set the system time.

  • TITLE Set the window title of the CMD.EXE session.

  • TREE Displays the directory structure of a drive or path in graphical mode.

  • TYPE Display the contents of the text file.

  • VER Displays the Windows version.

  • VERIFY tells Windows whether to verify that the file was correctly written to disk.

  • VOL Display the disk volume label and serial number.

  • XCOPY Copy files and directory trees.

The command can be in both uppercase and lowercase letters.

For more programming related knowledge, please visit: Programming Video! !

The above is the detailed content of What is the c++ clear screen function?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template