Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

C's system() & COMMAND.COM (Developers)

posted by nidud(R) E-mail, Norway, 11.09.2014, 23:22


int system(const char *command) - issues an MS-DOS command

system invokes the MS-DOS command processor to
execute a command given in the string command, as if the command
had been typed at the DOS prompt.

The COMSPEC environment variable is used to find the
command processor file, so the file does not need to be in
the current directory.

If command is a NULL pointer then system() returns nonzero if
a command processor is available.  If command is not a NULL pointer,
system() returns zero if the command processor was successfully
started.  If an error occurred, a -1 is returned and errno is set to

ENOENT  - command processor not found
ENOMEM  - not enough memory
E2BIG   - argument list too long
ENOEXEC - the command processor is not a valid executable


int system(command) - send the command line to a shell

Executes a shell and passes the command line to it.
If command is NULL, determine if a command processor exists.

char *command - command to pass to the shell
(if NULL, just determine if command processor exists)

if command != NULL  returns status of the shell
if command == NULL  returns non-zero if CP exists, zero if CP doesn't exist


Complete thread:

Back to the forum
Board view  Mix view
15317 Postings in 1383 Threads, 254 registered users, 21 users online (0 registered, 21 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum