× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Barbara



Thank you, I have learnt some more.

I am using Jevgenis suggestion to pass pointers to pointers.

I have made fOpenFiles 'static', thanks for the warning.



Frank



*From: Barbara Morris <bmorris@xxxxxxxxxx>

*Date: Thu, 03 Apr 2014 13:31:44 -0400

Rather than make the file pointers global,

you could have the function just handle one file at a time,

with the filename and open-mode as parameters, and returning the file
pointer.



pf = fOpenFile (PFILENAME, "rr");

...



static _RFILE *fOpenFile(const char *filename,

const char *openmode,

int rc)

{

_RFILE *f;

f = _Ropen(filename, openmode);

if (f EQ NULL)

{

printf("can't open file %s\n", PFILENAME);

exit(rc);

}

return f;

}



Be careful to code "static" for any function that you want to be local to
the module.
I would not use GLOBAL for this, since that would be very confusing, even
though it would work.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.