LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

time_t strikes again....

I am having my perpetual battle with time_t and CVI. I have toolbox.h included in one of my modules.
This line:
CVIFUNC GetFileCLibTime(char filePath[], time_t *time);
is ging me a missing parameter type error on the time_t.

BTW, right after the #include toolbox.h I have

time_t starttime; //begining

which compiles fine. Please, please how can I fix this?
0 Kudos
Message 1 of 9
(4,721 Views)
Hi,

You have to pass the function a time_t pointer. Here are two ways:

char filePath[] = "some_file_name";
time_t timeval, *timeptr = &timeval;

// This works:
GetFileCLibTime (filePath, timeptr);
// Or this:
GetFileCLibTime (filePath, &timeval);

Note: using the name 'time' as a variable will conflict with data in time.h

Cheers,
George Hodgson

"Woolie Willie" <x@no.email> wrote in message news:169838@exchange.ni.com...
> I am having my perpetual battle with time_t and CVI. I have toolbox.h
included in one of my modules. <br>This line:<br> CVIFUNC
GetFileCLibTime(char filePath[], time_t *time);<br>is ging me a missing
parameter type error on the time_t.<br><br>BTW, right after the #include
toolbox.h I have <br><br>time_t starttime; //begining<br><br>which compiles
fine. Please, please how can I fix this?


0 Kudos
Message 2 of 9
(4,711 Views)
You misunderstand me. I am saying that the include file causes a compile error.
0 Kudos
Message 3 of 9
(4,696 Views)
What other headers to you have included in your c file?

I have the following sample that compiles fine.


#include <cvirte.h>
#include <userint.h>
//Headers for UIR
#include "toolbox.h"

static int panelHandle;
static time_t fileTime;
int main (int argc, char *argv[])
{

if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "test.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
GetFileCLibTime ("c:\\1\\uir test\\1.h", &fileTime);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}


It compiles ok for me.
Bilal Durrani
NI
0 Kudos
Message 4 of 9
(4,692 Views)
#include "pannew.h"

#include "phonefind.h"
#include "reports.h"
#include "recording.h"
#include "delimiter.h"
#include "rules.h"
#include "cdf.h"
#include "sdf.h"
#include "layout.h"
#include
#include
#include "setup.h"
#include "cviinet.h"
#include
#include "rules.h"
#include "inifile.h"
#include "dbase.h"
//#include "nireport.h"
//#define _TIME_T_DEFINED
#include "toolbox.h"
#include "d4all.h"
#include
#include "srllib.h"
#include "dxxxlib.h"
#include "pwctrl.h"

#include
#include "srltpt.h"
#define UNDER_WIN95
#include "cbn_.h"
time_t starttime; //begining
0 Kudos
Message 5 of 9
(4,682 Views)
I also tried putting

typedef long time_t right before the define toolbox.h, but I still get the error

autodial.c - 3 errors,8 warnings
"toolbox.h"(197,58) Missing parameter type.
"toolbox.h"(197,65) syntax error; found '*' expecting ')'.
"Io.h"(95,1) syntax error; found 'typedef' expecting ';'.
0 Kudos
Message 6 of 9
(4,679 Views)
I think you misunderstood my reply. I used the .h file you specified
(toolbox.h) and was able to compile my example with no errors.

"Woolie Willie" <x@no.email> wrote in message news:170137@exchange.ni.com...
> You misunderstand me. I am saying that the include file causes a compile
error.


0 Kudos
Message 7 of 9
(4,672 Views)
George, thanks but all fixed. I commented the line that was giving the error in the .h file and all is AOK.
0 Kudos
Message 8 of 9
(4,670 Views)
Excellent. Thanks for the followup Woolie Willie. Was it anything other
programmers should watch for?

"Woolie Willie" <x@no.email> wrote in message news:170338@exchange.ni.com...
> George, thanks but all fixed. I commented the line that was giving the
error in the .h file and all is AOK.


0 Kudos
Message 9 of 9
(4,668 Views)