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

  • Home
  • SEARCH
  • 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 6073345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:15:39+00:00 2026-05-23T10:15:39+00:00

I have to write a function that accepts a variable number of arguments, similar

  • 0

I have to write a function that accepts a variable number of arguments, similar to the open() function

int open (const char *filename, int flags[, mode_t mode])
  1. I had a look at the va_list functionality, but how can I find out how many arguments the user has supplied? I dont want to have a parameter in the function that indicates this.

  2. Being a sort of newbie, where can I look how the open() function is implemented? How does open() know whether the user has supplied the mode argument or not?

Thanks in advance.

  • 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-23T10:15:40+00:00Added an answer on May 23, 2026 at 10:15 am
    1. You cannot. The caller must either supply a trailing sentinel argument (e.g. a 0), or explicitly tell the function how many arguments to expect (e.g. the format fields in printf).

    2. open knows to expect the third argument because you will have set the O_CREAT flag in the flags argument.

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

Sidebar

Related Questions

I'm trying to write a function that accepts a variable number of parameters like
How do I write a Javascript function that accepts a variable number of parameters,
I have this little function function makewindows(){ child1 = window.open (about:blank); child1.document.write(<?php echo htmlspecialchars(json_encode($row2['ARTICLE_DESC']),
I have one function GetControlRectangle(Rectangle MethodRect) that accepts the rectangle of the control. Now
I'm trying to write a simple bash script that accepts all arguments and interprets
I have a class with an Attach function that accepts a function object and
I have to write a function, that returns true if a given list is
I have this Array i wrote a function MostFreq that takes an array of
I want to write a little DBQuery function in perl so I can have
I have to write an applet that brings up a password dialog. The problem

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.