I am looking for example C code to display error messages in the DBOPEN;
test for errors in the FOPEN
and test for end of file in the FREAD.
Can anyone with C knowledge take a quick peek?
Regards and happy friday.
-Craig
oid open_db(void)
{
DBOPEN(basename,password,&mode,status);
if (status[0] != 0)
{
buflen = sizeof(buffer);
DBERROR(&status, buffer, &buflen);
/* I AM LOOKING FOR CODE TO DISPLAY/LOG THE ERROR MESSAGE */
jcw.js.status = 1;
SETJCW(jcw.jv);
exit(3);
}
}
****************************************
/*-------------------------------------------------------*/
void open_flat_output(void)
{
foptions fopts;
aoptions aopts;
fopts.fs.domain = 0; /* new file */
fopts.fs.ascii = 0; /* binary */
fopts.fs.designator = 0; /* use formal file designator */
fopts.fs.format = 0; /* record format is fixed */
fopts.fs.carriage = 0; /* no carriage control */
fopts.fs.label = 0; /* no labeled tapes */
fopts.fs.no_f_equ = 0; /* allow file equates */
fopts.fs.typer = 0; /* standard file */
fopts.fs.reserved = 0; /* not used */
aopts.as.access = 1; /* write access */
aopts.as.multirecord= 0; /* non-multirecord mode */
aopts.as.locking = 0; /* no dynamic locking */
aopts.as.exclusive = 1; /* exclusive */
aopts.as.no_buf = 0; /* normal buffering */
aopts.as.multi = 0; /* no MULTI access */
aopts.as.no_wait = 0; /* nowait not in effect */
aopts.as.copy = 0; /* file is acce as its own file type */
aopts.as.reserved = 0; /* not used */
Dfilenum = FOPEN("XFLAT",
fopts.fv,
aopts.av,
recl, /* record length */
"*", /* device */
NULL, /* form message */
0, /* user labels */
10, /* block factor */
1, /* number of buffers */
0, /* spooler copies */
0, /* output priority */
INT_MAX, /* file size */
1); /* number of extents */
/HOW DO I TEST FOR ERRORS? */
}
/*-------------------------------------------------------*/
/*-------------------------------------------------------*/
void read_flat_write_printer(void)
{
for(x=0;;x++)
{
FREAD(Pfilenum, buffer, recl);
/* HOW DO I TEST FOR END-OF-FILE? */
/* if (eof) break; */
control_code = 0;
FWRITE(Pfilenum, buffer, recl, control_code);
}
}
/*-------------------------------------------------------*/
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|