Quick links
Latest articles
Internship
Members
New...
Algorithms
Discrete Mathematics
Big data
Languages
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL
Web
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.
Programs
C
C++
DS
Java
C#
Python
Aptitude
C
C++
Java
DBMS
Interview
C
Embedded C
Java
SEO
HR
CS Subjects
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS
More...
Articles
Puzzles
News/Updates

Home » C programming language

What is the function to execute Linux/Windows DOS commands in C language?



This is a common interview question in C programming language. Here, we are going to discuss which function is used to execute Windows DOS or Linux command in C programming language.
Submitted by IncludeHelp, on May 10, 2018

Whenever we need to execute system command like DOS command or Any Linux command, we cannot send it to the operating system directly, we need a function that will accept the command in the C program and send it to the operating system to execute.

Then, Which function is used to execute DOS, Linux command?

There is a function named system() in C programming language, which is defined in stdlib.h file. This function executes Linux Terminal Commands as well as Windows DOS Command (you must be aware the specific system commands while using this function).

Syntax:

system(char *command);

Example:

    char *command = "ls";
    system(command);

This function takes one argument which is a character pointer that contains the specified command to be executed.

Read more: Executing system commands using C program






Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Featured post:
Introduction to Linux (Its modes, Safety, Most popular Applications)
Linux Best Distribution Software (Distros) of 2018

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.