CONTENTS | INDEX | PREV | NEXT
wbmain
NAME
wbmain - main program entry when run from workbench
SYNOPSIS
int
wbmain(struct WBStartup *wbs)
{
/* your main code goes here */
return(exitcode);
}
FUNCTION
The wbmain() routine is the entry point called after normal
initialization of c.lib and the program enviroment is done
by the startup module (c.o) and _main() routine (in c.lib).
wbmain() is called when the program is run from the workbench,
main() is called when the program is run from the CLI. Currently
the exit code is ignored.
The standard workbench startup message is passed to wbmain(), you
can process or ignore this message as you like but should NOT
ReplyMsg() it. I repeat, do NOT ReplyMsg() it. When you return
from wbmain() or exit() out of the program the exit code will
automatically deal with the message.
EXAMPLE
/*
* If run from the workbench this program will create a file
* T:XX instead of printing something on the console (since there
* is no console in that case).
*/
#include <stdio.h>
int
main(ac, av)
int ac;
char **av;
{
puts("This was run from a CLI");
return(0);
}
int
wbmain(msg)
void *msg; /* to make the example less complex */
{
FILE *fi = fopen("T:xx", "w");
fprintf(fi, "This was run from the WORKBENCHn");
fclose(fi);
}
SEE ALSO
maic.an