Very basic Include a function in a program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Atropo

    Very basic Include a function in a program

    Hi all,
    All that I have done in c is a hello word, but I'm RTFM. I have to
    extract the time from a usb-key from HASP-HL Aladdin. The software
    that came with this brings me the code in c that do this

    this is :

    hasp_status_t status;
    hasp_time_t time;
    status = hasp_get_rtc(ha ndle, &time);
    /* check if operation was successful */
    if (status != HASP_STATUS_OK)
    {
    switch (status)
    {
    case HASP_INV_HND:
    break;
    case HASP_NO_TIME:
    break;
    default:
    break;
    }
    }
    unsigned int day, month, year, hour, minute, second;
    status = hasp_hasptime_t o_datetime(time , &day, &month, &year, &hour,
    &minute, &second);
    if(status == HASP_INV_TIME)
    {
    /* handle error */
    }

    *************** *
    So i tried to include in a main but throws a lot of undeclare
    'hasp_status_t' ,'hasp_time','s tatus','handle' and a lot of parse
    errors too.

    this is what I did.

    #include <stdio.h>

    char get_lafecha( )
    {
    hasp_status_t status;
    hasp_time_t time;

    status = hasp_get_rtc(ha ndle, &time);

    /* check if operation was successful */
    if (status != HASP_STATUS_OK)
    {
    switch (status)
    {
    case HASP_INV_HND:
    break;
    case HASP_NO_TIME:
    break;
    default:
    break;
    }
    }

    unsigned int day, month, year, hour, minute, second;

    status = hasp_hasptime_t o_datetime(time , &day, &month, &year, &hour,
    &minute, &second);

    if(status == HASP_INV_TIME)
    {
    /* handle error */
    }
    return status
    }

    char main()
    {
    char lafecha;
    lafecha = get_lafecha()
    printf(lafecha) ;
    }

    how could I accomplish this
  • Flash Gordon

    #2
    Re: Very basic Include a function in a program

    Atropo wrote, On 25/05/08 07:15:
    Hi all,
    All that I have done in c is a hello word, but I'm RTFM. I have to
    extract the time from a usb-key from HASP-HL Aladdin. The software
    that came with this brings me the code in c that do this
    >
    this is :
    >
    hasp_status_t status;
    hasp_time_t time;
    <snip>
    So i tried to include in a main but throws a lot of undeclare
    'hasp_status_t' ,'hasp_time','s tatus','handle' and a lot of parse
    errors too.
    <snip>
    how could I accomplish this
    I would assume that the library also came with a header which you need
    to include which provides declarations for all the times, prototypes for
    functions etc. I'm sure if you look at the documentation and/or example
    code they tell you what you need to include.
    --
    Flash Gordon

    Comment

    • Atropo

      #3
      Re: Very basic Include a function in a program

      On 25 mayo, 03:41, Flash Gordon <s...@flash-gordon.me.ukwro te:
      Atropo wrote, On 25/05/08 07:15:
      >
      Hi all,
      All that I have done in c is a hello word, but I'm RTFM.  I have to
      extract the time from a usb-key from HASP-HL  Aladdin. The software
      that came with this brings me the code in c that do this
      >
      this is :
      >
      hasp_status_t status;
      hasp_time_t time;
      >
      <snip>
      >
      So i tried to include in a main but throws a lot of undeclare
      'hasp_status_t' ,'hasp_time','s tatus','handle' and a lot of parse
      errors too.
      >
      <snip>
      >
      how could I accomplish this
      >
      I would assume that the library also came with a header which you need
      to include which provides declarations for all the times, prototypes for
      functions etc. I'm sure if you look at the documentation and/or example
      code they tell you what you need to include.
      --
      Flash Gordon
      Thanks a lot Flash. I'll look for those headers, but don't have
      much hope on their documentation.

      Comment

      Working...