Thread: passing argument 1 of 'strlen' makes pointer from integer without a cast

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    8

    passing argument 1 of 'strlen' makes pointer from integer without a cast

    I write code witch generate file name based on: destination directory settings, radio station presets list and current time.

    If users store radio station name (app presets) with white space in name:

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

    I want to remove whitespace for recording radio station filename and result look like this:

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


    Code:
    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;
    }
    But this get warnings:

    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]

    I appreciate your help. Thanks.
    Last edited by Buda; 07-05-2012 at 03:59 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 03-07-2012, 07:14 PM
  2. Replies: 2
    Last Post: 11-20-2011, 11:36 AM
  3. Replies: 8
    Last Post: 08-28-2009, 07:49 AM
  4. Replies: 17
    Last Post: 08-07-2009, 11:52 AM
  5. Replies: 4
    Last Post: 01-27-2009, 02:33 PM