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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:10:32+00:00 2026-05-25T18:10:32+00:00

I tried two ways: void func(const char *path, const char *arg0, …){ va_list args;

  • 0

I tried two ways:

void func(const char *path, const char *arg0, ...){
        va_list args;
        va_start(args, arg0);
        execl(path, arg0, args, NULL);
        va_end(args);
}
func("/bin/ls", "ls");

And:

void func(const char *path, const char *arg0, ...){
        va_list args;
        va_start(args, arg0);
        execl(path, arg0, args);
        va_end(args);
}

func("/bin/ls", "ls", NULL);

But seems non work as expected after several test…

What’s wrong in my way of wrapping variable length parameters?

  • 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-25T18:10:33+00:00Added an answer on May 25, 2026 at 6:10 pm

    Since you don’t know how many arguments you’ll be receiving, you’ll need/want to use execv instead of execl. You’ll need to walk through the arguments, retrieve a pointer to the beginning of each string, and put them into an array. You’ll then pass the address of that array to execv.

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

Sidebar

Related Questions

I tried two ways of catching unexpected unhandled exceptions: static void Main() { AppDomain.CurrentDomain.UnhandledException
I've tried two ways to constrain a generic type parameter to a nullable type,
In the code below I tried in two ways to access the parent version
I'm trying to embed video in pages. I tried two different ways but no
I tried two ways to do code completion, one is OK, the other fails.
I tried these two ways: (new NewsForm())->getWidgetSchema(); {new NewsForm()}->getWidgetSchema(); With no luck...
I've tried two ways. (1) User enters info->Ajax call to verify credentials->From server side
I have tried two different ways of flushing the output to the browser in
I've tried two different methods of reusing code. I have a solution full of
I have tried the following two statements: SELECT col FROM db.tbl WHERE col (LIKE

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.