|
*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 filepointer.
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 tothe module.
I would not use GLOBAL for this, since that would be very confusing, eventhough it would work.
This mailing list archive is Copyright 1997-2026 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.