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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:34:28+00:00 2026-06-06T21:34:28+00:00

The code below generate file name based on: destination directory, radio station name and

  • 0

The code below generate file name based on: destination directory, radio station name and current time:

static int start_recording(const gchar *destination, const char* station, const char* time)
{
    Recording* recording;
    char *filename;

    filename = g_strdup_printf(_("%s/%s_%s"), 
        destination, 
        station,
        time);

    recording = recording_start(filename);
    g_free(filename);
    if (!recording)
        return -1;

    recording->station = g_strdup(station);

    record_status_window(recording);

    run_status_window(recording);

    return 1;
}

output example:

/home/ubuntu/Desktop/Europa FM_07042012-111705.ogg

Problem:

Same station name may contain white space in title:

Europa FM
Paprika Radio
Radio France Internationale
    ...........................
Rock FM

I want to help me to remove whitespace from generated filename
output to become so:

/home/ubuntu/Desktop/EuropaFM_07042012-111705.ogg

(a more complex requirement would to eliminate all illegal char. from filename)

Thank you.

UPDATE

If write this:

static int start_recording(const gchar *destination, const char* station, const char* time)
{
    Recording* recording;
    char *filename;

    char* remove_whitespace(station)
    {
        char* result = malloc(strlen(station)+1);
        char* i;
        int temp = 0;
        for( i = station; *i; ++i)
            if(*i != ' ')
            {
                result[temp] = (*i);
                ++temp;
            }
        result[temp] = '\0';
        return result;
    }

    filename = g_strdup_printf(_("%s/%s_%s"), 
        destination, 
        remove_whitespace(station),
        time);
    recording = recording_start(filename);
    g_free(filename);
    if (!recording)
        return -1;

    recording->station = g_strdup(station);
    tray_icon_items_set_sensible(FALSE);

    record_status_window(recording);

    run_status_window(recording);

    return 1;
}

Get this warning:

warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast [enabled by default]
warning: assignment makes pointer from integer without a cast [enabled by default]

  • 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-06T21:34:31+00:00Added an answer on June 6, 2026 at 9:34 pm
    void remove_spaces (uint8_t*        str_trimmed,
                        const uint8_t*  str_untrimmed)
    {
      size_t length = strlen(str_untrimmed) + 1;
      size_t i;
    
      for(i=0; i<length; i++)
      {
        if( !isspace(str_untrimmed[i]) )
        {
          *str_trimmed = str_untrimmed[i];
          str_trimmed++;
        }
      }
    }
    

    Removes spaces, new lines, tabs, carriage return etc.
    Note that this also copies the null termination character.

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

Sidebar

Related Questions

Im trying to generate a color gradient using ColdFusion. My current code below works
I wanted to generate a list view using below code. But after running this
The code below generates a warning CS3006 Overloaded method MyNamespace.Sample.MyMethod(int[])' differing only in ref
The below code generates the incompatible pointer type error: char *PLURAL(int objects, NSString *singluar,
I am trying to generate images using ImageMagick, please check the code below: <?
I am writing some code to generate an opml file from a list of
I use PHP to generate XML files. I have use some code below to
Below is the code that I am using: This is my app/models file: class
When I execute the code saveXML below it generates the error above, why?? using
I have a dialog box, created with the code javascript and HTML generated below.

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.