LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

extern FILE*

Ok im trying using the pointer in another file, how can I do it?

 

in the main file its declared as FILE *fileptr={0}

 

 

 

will I do this FILE extern *fileptr in the main file

 

and the othe file where i want to use it will i just char *fileptr={0};

 

 

how will i do this using extern with FILE pointer

0 Kudos
Message 1 of 3
(5,285 Views)

You probably have a common header file for your application - add the following line to it:

 

    extern FILE *fileptr;

 

All your source files will of course #include this common header file. In just one of your source files, you need to actually declare the object, initialising it as well if you like:

 

    FILE *fileptr = NULL;

 

The variable is now available to be used by all the source files that #include the header file. Of course, your sequence of execution needs to guarantee that the value of the variable is set correctly before any module reads it.

 

JR

 

Message 2 of 3
(5,272 Views)
thanks for your help.
0 Kudos
Message 3 of 3
(5,261 Views)