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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:07:40+00:00 2026-05-26T11:07:40+00:00

what I have to do is recursively get .mp3 archives from a determined pre-specified

  • 0

what I have to do is recursively get “.mp3” archives from a determined pre-specified directory and its subdirectories. I did not have a problem getting the mp3’s and printing them on console. I am using the ftw function specified in http://www.gnu.org/software/libc/manual/html_node/Working-with-Directory-Trees.html#Working-with-Directory-Trees, its call-back function would look like this:

/* Call-back of ftw function*/

int filter_mp3s(const char *dir_name, const struct stat *status, int typeflag){

    if (typeflag == FTW_D){

        struct dirent **mp3list;
        int num_archives;
        int counter;

        num_archives = scandir (dir_name, &mp3list, select_mp3_ext, alphasort);

        /* print mp3 names */
        if (num_archives > 0) for (counter = 0; counter <= num_archives - 1; counter++) printf("%s\n", mp3list[counter]->d_name);

    }

    return 0;
}

What I really want to do is put the names of the files into a GTK combo-box widget. Problem is, that function returns an int type and the function is not flexible with its parameters so I could “save” in something the entries. In other words, mp3’s are found but I have no idea how I could keep the results in order to load them in the combo-box in other function. I do not want to use global variables…
I’m new into this, thanks in advance for your help.

  • 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-26T11:07:41+00:00Added an answer on May 26, 2026 at 11:07 am

    If the callback doesn’t have a customer argument (usually a void*) which appears to be the case, you will have to put found data into a global variable, which is unfortunate.
    If that’s a problem (i.e. you are in a multithreaded environment) you will have to implement your own version of recursive directory traversal using opendir interface. It’s not difficult.

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

Sidebar

Related Questions

I need to get the size of a directory, recursively. I have to do
I have the following code to recursively search for files through a directory, which
The unzip command doesn't have an option for recursively unzipping archives. If I have
I'm trying to get all pdf's recursively from the External storage. What I'd like
I have a script that scans subdirectories recursively and deletes files older than X
I want to recursively search a directory tree and get the 10 most recently
I am trying to get recursively load all the assets I have placed within
I am trying to get the sub-sections of sections recursively from the database. Right
I want to recursively search through a directory with subdirectories of text files and
I'm trying to recursively get a directory structure in Java, on an Android emulator,

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.