GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 447 of 453    Print  
Execute Shell Command
How will you execute shell command without using system command in C-language? Write a program to execute ls -l and redirect the output to a file, without using system command ?


  
Total Answers and Comments: 1 Last Update: April 01, 2009     Asked by: shashank_09 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 01, 2009 03:00:41   #1  
phanirvcse Member Since: April 2009   Contribution: 1    

RE: Execute Shell Command

You can use exec family of system calls to get the job done. Its a nice experience go ahead and explore it.


 
Is this answer useful? Yes | No

 Related Questions

Most operating systems, including DOS, provide a means to redirect program input and output to and from different devices. This means that rather than your program output (stdout) going to the screen; 
Latest Answer : By using the operators "" we can redirect the standard input and out streams.example : d:> jinto.exe > outputredirected                d:> ...

The #pragma preprocessor directive allows each compiler to implement compiler-specific features that can be turned on and off with the #pragma statement. For instance, your compiler might support a feature 
Latest Answer : To pack one byte aligned #pragma pack(1) ...

The standard C library provides a function named atexit() that can be used to perform “cleanup” operations when your program terminates. You can set up a set of functions you want to perform 

If the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output? main(int argc, char *argv[]) {    int i;    for(i=0;i
A) 1 2 3B) C:MYPROG.EXE123C) MYPD) None of the above 

If the following program (myprog) is run from the command line as myprog 1 2 3, What would be the output? main(int argc, char *argv[]) {    int i,j=0;    for(i=0;i
A) 1 2 3B) 6C) errorD) "123" 

If the following program (myprog) is run from the command line as myprog monday tuesday wednesday thursday What would be the output? main(int argc, char *argv[]) { while(--argc >0) printf("%s",*++argv); }
A) myprog monday tuesday wednesday thursdayB) monday tuesday wednesday thursdayC) mondaytuesdaywednesdaythursdayD) myprog tuesday thursday 

If the following program (myprog) is run from the command line as myprog friday tuesday sunday,  What would be the output? main(int argc, char*argv[]) { printf("%c",**++argv); }
A) mB) fC) myprogD) friday 

If the following program (myprog) is run from the command line as myprog friday tuesday sunday, What would be the output? main(int argc, char *argv[]) { printf("%c",*++argv[1]); }
A) rB) fC) mD) y 

According to ANSI specifications which is the correct way of declaring main() when it receives command line arguments?
A) main(int argc, char *argv[]) B) main(argc,argv) int argc; char *argv[];C) main() {int argc; char *argv[]; }D) None of the above 

Write a program which accepts a filename as a command line argument and coverts all characters in the file to uppercase.


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

What is the use of truncate command?

Truncate command will delete all records and the most important thing to make note of truncate command is since truncate command cannot be rolled back one must make sure to take proper backup of table data before performing the truncate command. Truncate command is thus used to remove all rows from
 

How to define command line arguments

The main functions can have arguments passed which are called as command line arguments. There are two command line arguments: Argument count denoted by argc and Argument vector denoted by argv The argc is an integer variable which denotes the number of parameters passed and argv is pointer to a
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.  By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.  IT Certification offers several vari
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape