home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
chint
/
useful05.hnt
< prev
next >
Wrap
Text File
|
1992-03-26
|
2KB
|
61 lines
## WARNING ##
Unfortunately this does not appear to be practical in DataBoss for "C"
because the total memory needed by both programs is excessive, ie you
get a "Not Enough Memory" error when you attempt to spawn the program.
/*
A function that runs a report directly from the database, that can pass
a command line parameter, (presumably a database field like an account
number), that could be used in the report range checking or as a
start/end key value.
NOTE : The DataBase program itself will need to have the line
#include <process.h>
added to the top of the program.
*/
void run_Report(string progName)
{
int spawnres; /* check in spawn() suceeded */
string CL; /* store a command line */
long savR; /* save current position */
cursortyp saveCurs; /* save cursor */
strcpy(CL," -1Alex_Was_Here");
if(lcd) strcat(CL," -LCD"); /* Pass LCD mode to the report */
if (!ehk) strcat(CL," -K"); /* Suppress keyboard if necessary */
savR = recno[1];
closefiles(); /* Free up all the files for the report to open */
curfun(_GetCurs,&saveCurs); /* store current cursor */
curfun(_SetCTyp,&linecurs); /* restore the normal underline cursor */
spawnres = spawnlp(P_WAIT,progName,progName,CL); /* Run the report */
if (spawnres == -1) spawnres = errno;
curfun(_SetCTyp,&saveCurs); /* restore cursor to saved state */
openfiles(); /* Re-Open all the files */
dispallwin();
align_rec(savR); /* Re-Align the database */
}
***** The follow is a simple procedure that will get the command line *****
***** parameter string passed by "run_Report". *****
string theStart; /* A global variable for range checks */
void setStart(void)
{
int i;
string TS;
strcpy(theStart,"zzzzz"); /* Initialize start to some value */
for (i = 1; i <= paramcount(); i++) {
strcpy(TS,paramstr(i));
if ((TS[0] == '-') && (TS[1] == '1'))
strcopy(theStart,TS,2,strlen(TS)-2);
}
}