Improving Performance when Using Stream Input and Output Functions
Although using ILE C record I⁄O functions improves performance more effectively than stream I⁄O functions, there are still ways to improve performance when using stream I⁄O.
You can use IFS stream files, with performance similar to record I/O functions, by specifying SYSIFCOPT(*IFSIO) on the CRTCMOD or CRTBNDC commands.
You should use the macro version of getc instead of fgetc() to
read characters from a file. See Using Static Class Member Functions or Global Variables.
The macro version of getc() reads all the characters
in the buffer until the buffer is empty. At this point, getc() calls fgetc() to
get the next record.
For the same reason, you should use putc() instead
of fputc(). The macro version of putc() writes
all the characters to the buffer until the buffer is full. At this
point, putc() calls fputc() to write
the record into the file.
printf(): printf("Enter next item.\n");
printf("When done, enter 'done'.\n");
printf() can be combined into
a single call so that one call is saved as follows: printf("Enter next item.\n"
"When done, enter 'done'.\n");