Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4274540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:51:39+00:00 2026-05-21T07:51:39+00:00

I want to compile a source C in a parent process and then ,

  • 0

I want to compile a source C in a parent process and then , the executable created , I want to run it into a son process. Any ideas?

Thank you.

#include <stdio.h>
#include <stdlib.h>

#define execle("/bin/ls","bin/ls","-l",NULL);

int main(int argc , char **argv )
{
    int i;
    for(i=1 ; i<argc ; i++)
    {
        if(argv[1]==".c")
        {
            if(fork()==0)
            {
                execle("/usr/bin/gcc","/usr/bin/gcc",argv[1],NULL);
                exit(1);
            }    
        }

        if(argv[2]==".out")
        {
            if(fork()==0)
            {
                execle("/bin/cat","bin/cat/",argv[2],NULL);
                exit(1);
            }
        }
    } 
    return 0;
}

Here is how the code looks like , but can you tell me why it gives me errors on the lines where execle(..) is ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:51:40+00:00Added an answer on May 21, 2026 at 7:51 am

    In your parent/driver program, use the system(3) call or a combination of fork/exec/wait to run your compiler. Then you can use the same calls to run the newly compiled executable.

    Keep in mind the security aspects of this while implementing it. This kind of thing has a huge exploit potential.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've an open source project (gdal) that I want to compile and run as
I want to compile a batch file into an EXE file using C++. I
I want to compile a project (with CruiseControl) not only if its source changes,
I have a project on Lazarus that I want to compile a source using
I want to include ANT, the JavaSDK and FlexSDK into my project directory. I
Is it possible to cross-compile D source code for MIPS? For example, I want
I want to compile an open source iPhone app( https://github.com/newsyc/newsyc/ ) but since I
i want to learn modify and compile source, what i need to learn,can you
I've just found some source on the web and want to compile it. When
If I want to compile a c source file that uses libxml, how do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.