Incororating a program into another

This is a discussion on Incororating a program into another within the C Programming forums, part of the General Programming Boards category; I created a collection of programs into I want to incorporat all my programs! I will run the program and ...

  1. #1
    #C-help
    Join Date
    Jun 2007
    Location
    Las Vegas
    Posts
    53

    Incororating a program into another

    I created a collection of programs into I want to incorporat all my programs! I will run the program and select wich program I want to run! How exactly do i do that? Would it work if I would do a FILE *fp
    with fopen and open the compiled source code, the program! I am running Linux!

    I AM SORRY I CAN NOT POST THE CODE BECAUSE I WOULD GET BANNED FROM CPROGRAMMING!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You have essentially two choices: Either use the system() function to execute an external program.
    http://linux.die.net/man/3/system

    Alternatively, (this is the advanced method) you could have a design where your standalone applications are compiled as shared libraries with a small stub that essenitally is your main function that does little else than call the function in the shared library (perhaps some parsing of argc/argv). Then in your "all in one" software, you link to all of the shared libraries, and have the small call to the shared library.

    The first suggestion is the easy one, the second suggestion is definitely more difficult if you are not familiar with shared libraries and advanced programming concepts.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    http://faq.cprogramming.com/cgi-bin/...&id=1043284392

    GIYF. Searching the FAQ isn't a bad idea either.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21