Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to use unix command in c program

    I am new to Linux world.I know the basic commands in Unix.and I want to develop a c program using Unix command .plz send me the example program

    thanks to all.

  2. #2
    #include <stdlib.h>
    int main()
    return 0;

    hope it helps

  3. #3
    Just Joined! brahan_7's Avatar
    Join Date
    Dec 2007
    Deep South
    int main(int argc, char *argv[])
    char* userId;
    char buffer[10];

    if(argc != 2) {
    cout << "usage: " << argv[0] << " cmd line arg.\n";

    userId = argv[1];
    sprintf (buffer, " %s", userId);

    return 0;


    This program finds the full name that matches a userId entered as a cmd line arg...
    All you need to worry about is the sprintf and system parts and use them as an example.

    This basically works by alowing you to represent your commands as text and them use a system call to run them the system call goes out like anyother function and will return back to the where it left off just like anyother function.

    Also check out these websites:

    Post anymore questions!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts