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



On 2014-04-03 06:42, Frank Kolmann wrote:
I have posted the new source here.
http://wiki.midrange.com/index.php/C_version_of_DISPR
As Barbara suggested I moved the Open of the files into a function.
I had to make the file pointers GLOBAL, to get the program to work.

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-Ups:

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.