fldata() example
Figure 1 example shows the retrieval of the file name in filename from the open stream pointed to by stderr that maps to the CELQPIPI MSGRTN file.
Figure 1. fldata()
example
#include <stdio.h>
int main(void) {
FILE *stream;
char filename[100];
fldata_t fileinfo;
int rc;
stream = stderr;
rc = fldata(stream, filename, &fileinfo);
if (rc != 0)
printf("fldata failed\n");
else
printf("filename is %s\n",filename);
}
The program in Figure 1 produces the following output:
filename is ((MSGRTN))
The example in Figure 2 shows the use of the CELQPIPI
MSGRTN file as the default stderr.
Figure 2. CELQPIPI MSGRTN example
#include <stdio.h>
#include <errno.h>
int main(void) {
FILE *stream;
stream = stderr;
fprintf(stream, "fprintf: Output redirects to the CELQPIPI MSGRTN file.\n");
errno = ETIME;
Perror("perror: Output redirects to the CELQPIPI MSGRTN file.");
}