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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:34:16+00:00 2026-06-01T02:34:16+00:00

What are the default argv data types? I want to grab 2 arguments from

  • 0

What are the default argv data types?

I want to grab 2 arguments from the cmd line and pass these arguments to fts_open with the return being set to fts_read. first being source folder path and second being output file path.

I previously passed argv + 1 and it sent the first argument, as well as the second argument, so the source and the output path was being included in the paths to traverse.

I only want to source path to be used for fts_open.

I know fts_open takes a NULL terminated list, I would like to create this from the first argument, the source. I had a few warnings before regarding different data types.

I just want to grab the first arg and store it in a char * and then create a NULL terminated list from this to pass to fts_open.

  • 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-01T02:34:18+00:00Added an answer on June 1, 2026 at 2:34 am

    You need to copy the argument in question to a new list that only includes that argument and the final NULL pointer

    int main(int argc, char **argv) {
        if (argc < 2) /* error */;
        char **copy = malloc(2 * sizeof *copy);
        copy[0] = malloc(strlen(argv[1]) + 1);
        if (!copy[0]) /* error */;
        strcpy(copy[0], argv[1]);
        copy[1] = NULL;
    
        whatever(copy/*, ... */);
    
        /* ... */
    
        free(copy[0]);
        free(copy);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get three arguments from command line: -o (for outputfile) -k
void foo(void* arg) { } int main(int argc, char** argv) { foo((void*)1); return 0;
why can't I do something like this: files = [file for file in ['default.txt'].append(sys.argv[1:])
I'm trying to solve a K&R exercise(5.10) that uses the argc and argv arguments.It's
By default in Boost.Serialization, enum types are serialized as a 32-bit integer. But I
I want to configure Emacs so that it has: Increased default font size. Currently
default is 49 how to edit to higher?
The default shell in Mac OS X is bash , which I'm generally happy
By default each row of a Gridview maps to each row in a datatable
By default IntelliJ IDEA 7.0.4 seems to use 4 spaces for indentation in XML

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.