Very basic Include a function in a program

A

Atropo

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(handle, &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_to_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','status','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(handle, &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_to_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
 
F

Flash Gordon

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;

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

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.
 
A

Atropo

Atropo wrote, On 25/05/08 07:15:








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.

Thanks a lot Flash. I'll look for those headers, but don't have
much hope on their documentation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top