Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanftantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : system
intsystem(const char * command) ;
Return Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of system function .
1st Parameter Type : const char *
Pointer to read-only string
1st Parameter
Pointer to a null-terminated string containing the command to be executed by the host environment's command processor. If this is `NULL`, the function simply checks for the availability of a command processor.
Read more about parameters of system in parameters section
The systemfunction in C language Executes a command string in a command processor or shell.
The system function passes the command string to the host environment to be executed by a command processor. The command is executed in a separate process, and the calling process waits for its completion. This function provides a way to execute system commands from within a C program.
The systemfunction takes 1
parameter:Executes the command specified by the string `command` in a new process, using the host environment's command processor. If `command` is `NULL`, the function returns a nonzero value if a command processor is available, or `0` otherwise. Returns the exit status of the command or `-1` if a new process could not be created.
- •const char * `command`: Pointer to a null-terminated string containing the command to be executed by the host environment's command processor. If this is `NULL`, the function simply checks for the availability of a command processor.
The system function return value :
- If command is NULL, returns nonzero if a command processor is available
- If command is not NULL, returns the exit status of the command executed (implementation-defined)
- If a child process could not be created or its status could not be retrieved, -1 is returned
Output
This example demonstrates basic usage of system to execute the 'ls -l' command on a Unix-like system. It also checks the return value to determine if the command was executed successfully.