Run-Time Library Reference System,

xiaoxiao2021-03-06  61

Run-Time Library Reference

System, _wsystem

Execute a command.

Int system

Const char * Command

);

INT_WSYSTEM

Const Wchar_t * Command

);

Parameter

Command

Command to be elected.

Return Value

If command is NULL and the command interpreter is found, returns a nonzero value. If the command interpreter is not found, returns 0 and sets errno to ENOENT. If command is not NULL, system returns the value that is returned by the command interpreter. It Returns The Value 0 Only if The Command Interpreter Returns The Value 0. A Return Value of - 1 Indicates An Error, And Errno IS Set To One of the Following Values:

E2BIG

Argument List (Which is System Dependent) is to BIG.

ENOENT

Command interpreter cannot be found.

ENOEXEC

Command-Interpreter File Has Invalid Format and is not Executable.

Enomem

NOT ENOUGH MEMORY; OR Available Memory Has Been Corrupted; OR Invalid Block Exists, Indicating That Process Making Call Was Not Allocated Properly.

See _doserrno, errno, _sys_ERRLIST, AND _SYS_NERR for More Information On these, And Other, Return Codes.

Remarks

The system function passes command to the command interpreter, which executes the string as an operating-system command. System refers to the COMSPEC and PATH environment variables that locate the command-interpreter file (the file named CMD.EXE in Windows NT). If Command is Null, The Function Simply Checks To See WHETHER The Command Interpreter EXISTS.

You Must Explicitly Flush (Using Fflush or _flushall) or Close Any Stream Before Calling System.

_wsystem is a wide-character version of system; the command argument to _wsystem is a wide-character string. these Functions Behave Identical Otherwise.

Generic-text routine mappingstchar.h routine _unicore & _mbcs not defined_MBCS defined_unicode defined_tsystemsystemsystem_wsystem

Requirements

RoutineRequired headercompatibilitysystem or Ansi, win 98, win me, win nt, win 2000, win xp_wsystem or or win nt, win 2000, WIN XP

Libraries

All Versions of The C Run-Time Libraries.

EXAMPLE

This Program Uses System to Type a Text File.

// CRT_SYSTEM.C

#include

Int main (void)

{

System ("Type Crt_System.txt");

}

Input: CRT_SYSTEM.TXTLINE ONE.

Line two.outputline one.

Line Two.

转载请注明原文地址:https://www.9cbs.com/read-85052.html

New Post(0)