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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:10:45+00:00 2026-06-18T15:10:45+00:00

This is a bit frustrating. I’ve been working on this for a while now,

  • 0

This is a bit frustrating. I’ve been working on this for a while now, and I can’t seem to get this method to work like it says it does.

#include "icalrecur.h"
#include <time.h> /* for time() */
#include <stdio.h>

int get_occurrences(char* rrule, time_t start, int count)
{
        //char*        rule; /* rule string */
       // *rule = PG_GETARG_CHAR(0);

        time_t   *result[count]; /* output array */

        icalrecur_expand_recurrence(rrule, start, count, *result);

        return (time_t) *result;
}


//time_t *output[5*8];

void main() {
        time_t right_now = time(0);
        char *_rrule = "FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH";
        get_occurrences(_rrule, right_now, 5);
}

I save this test file as ical_recur.h. Then I type in bash:

gcc -I/usr/local/libical/include/libical -L/usr/local/libical/lib/ -lical -o hello ical_recur.c

To include the libical.a libraries. The include/libical directory has icalrecur.h in it, so I really don’t even need to be including the whole ical library.

~: ./hello
Segmentation fault

Anytime I change around any pointers, it starts complaining about something during compilation. Can anyone get this to work?? Source files are from Marketcircle on github.

  • 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-18T15:10:46+00:00Added an answer on June 18, 2026 at 3:10 pm

    Looking at the documentation it seems that you have an unwanted extra level of indirection – you need to change:

        time_t   *result[count]; /* output array */
    
        icalrecur_expand_recurrence(rrule, start, count, *result);
    

    to:

        time_t   result[count]; /* output array */
    
        icalrecur_expand_recurrence(rrule, start, count, result);
    

    Also you’re passing a read-only string literal to a function which expects a char * – this should at least give you a compiler warning (hint: always use gcc -Wall ..., read the warnings carefully, understand them and fix them). main() should look more like this:

    int main() {
        time_t right_now = time(0);
        char _rrule[] = "FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH";
        get_occurrences(_rrule, right_now, 5);
        return 0;
    }
    

    Some more problems:

    • this line doesn’t do anything useful, but it’s not clear what you’re trying to achieve:

      char _size = (char)(((int)'0') + sizeof(result));
      

      all those casts are a “code smell” and this should tell you that you’re doing something very wrong here

    • your function is defined as returning an int, but you’re trying to cast your array to a time_t and return that, which also makes no sense – again, turn on compiler warnings – let the compiler help you find and fix your mistakes.

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

Sidebar

Related Questions

This is been making my programming really frustrating lately. I´m in Argentina right now
I've spent a very frustrating evening trying to get wxpython to work on my
please can someone help. this form validation is not triggering.. It's really frustrating me.
This is a bit frustrating. According to Symfony best practices, a bundle's web assets
Hope someone can help with a bit of a frustrating issue. I have a
This is a beginner question, but it's been frustrating me... I am using C#,
I already have this working in Firefox, Safari and Chrome. I would like to
This one might be a bit basic and easy to answer, but I've been
I'm hardly an expert in css, so this is a bit frustrating. I have
It may sound a bit trivial but it actually is quite frustrating: Can anyone

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.