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 8408831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:44:24+00:00 2026-06-09T23:44:24+00:00

I am coding on Windows, so fork() is not available. Now, i need to

  • 0

I am coding on Windows, so fork() is not available. Now, i need to run execl(), but it is an end point of my program! I thought of creating a separate thread to run execl(), which is created successfully, and runs well also. But still my program comes to an end after thread is over.
Function running thread–It is inside class wScoreget:-

     int refresh_score_now(){
            pthread_t t;
            if(pthread_create(&t,NULL,s.basicgetscore,&s)==-1){
                                printf("Error: wScoreget:3");
                                exit(4);
                                }

            void *a;
            if(pthread_join(t,&a)==-1){
                printf("Error: wScoreget: 4");
                exit(4);
                printf("Running thread.\n");
                getch();
            }

        }

Calling from main:-

            int main(){

    wScoreget new_ws;
    new_ws.refresh_score_now();
    printf("reached to the end\n");
    getch();
    }

I am expecting console to print- “reached to the end”
But on execl() it exits.
NOTE: execl() is running curl. Its output is going to a text file. Now, if stdout is changed, curl shows download timing and other data on the console. THAT data comes to console anyways.

Is there a way I can do this without using CreateProcess? And if I use CreateProcess, which libraries do I have to install on Windows(I am using MingW + Codeblocks).

  • 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-06-09T23:44:25+00:00Added an answer on June 9, 2026 at 11:44 pm

    Try using spawn or posix_spawn. It should replace fork + exec.

    • http://en.wikipedia.org/wiki/Spawn_%28computing%29
    • http://linux.die.net/man/3/posix_spawn
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm coding a windows program which is a WYSIWYG form generator. In a very
I'm coding in OpenNetCF for WIndows Mobile 6.0. I need my application to connect
I intend to learn C# and start coding Windows .exe applications, but the only
I've not done much coding for Windows lately, and I find myself sitting at
I'm coding a simple primality tester program for Windows in x86 assembly language (MASM32),
I am coding a screensaver program running on Windows. In preview mode, Windows calls
I'm currently working on a Windows based C++ program. I am used to working/coding
I'm coding a Windows Forms App that has a StatusStrip that displays status informations
I'm coding a windows form using WPF, XAML, C#. I have a Frame object
I have never done any Windows coding and I would like to give it

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.