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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:14:07+00:00 2026-05-22T02:14:07+00:00

I use the execl() function with that call: execl(/localhome/globususer/mandel, -b, xmin, xmax, ymin, ymax,

  • 0

I use the execl() function with that call:

execl("/localhome/globususer/mandel", "-b", xmin, xmax, ymin, ymax, "-f", name, (char*)NULL);

All the xmin, xmax, ymin, ymax are initialized by:

sprintf(xmin, "%f", (double)(XPOS - realmargin));
sprintf(xmax, "%f", (double)(XPOS + realmargin));
sprintf(ymin, "%f", (double)(YPOS - realmargin));
sprintf(ymax, "%f", (double)(YPOS + realmargin));

In the targeted program (/localhome/globususer/mandel), xmin and ymin are detected as options since they are negative numbers.
So getopt() detects “-0” on their values, and raises an error.

However, a direct call from the command line such as:

./mandel -b -0.452902 0.456189 0.367922 1.277013 -f /localhome/globususer/mandel.ppm

is correctly understood by the program.

Does anybody have any idea?

  • 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-22T02:14:08+00:00Added an answer on May 22, 2026 at 2:14 am

    You’ re using execl() incorrectly. You should set arg0 to the name of the executable:

    execl("/localhome/globususer/mandel",
          "/localhome/globususer/mandel",
          "-b",
          xmin, 
          xmax, 
          ymin, 
          ymax, 
          "-f", 
          name, 
          NULL);
    

    From the man page:

    The const char *arg and subsequent ellipses in the execl(), execlp(), and execle() functions can be thought of as arg0, arg1, …, argn. Together they describe a list of one or more pointers to null-terminated strings that represent the argument list available to the executed program. The first argument, by convention, should point to the filename associated with the file being executed.

    When mandel runs getopt() with your original argument list, it skips over the -b (since it’s in argv[0], and it thinks that’s the executable path name), and therefore starts parsing the args with the number (-0.452902 in your example) instead of the -b. That makes it interpret the -0 as an option, and you’re out of luck.

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

Sidebar

Related Questions

I am trying to call a variable for use in another function. The variable
Based on my previous thread I'm trying to use ExtJS to call a function
I am working on a function that needs to call a stored procedure that
I am trying to use an API that returns the following structure <TwilioResponse> <Call>
I have a big problem. I use excel auto filter function, at the end
For those familiar with Excel, I'm trying to use a similiar NETWORKDAYS function within
I have a simple class library that I use in Excel. Here is a
Trying to use this following script to load a page so that I can
I have a function that calls an external rest service a lot. how often
I'm trying to use xmlrpc client from many QThreads. To make sure that only

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.