Printing a Memory File

You can send the contents of the memory file to the printer with the memory file print function, mf_print():

int mf_print(mfp)

MFILEPTR mfp;        /* Pointer to memory file to print        */

This function copies the character contents of the memory file to the printer file. When writing the contents to the file, spaces are compressed to tabs based on the number of spaces between tab stops. This is a global variable initially set to 8. You can change this value with se_tabq().

The printer specifications are global variables. The default depends on the operating system. For PCDOS, the printer is set to "prn". For UNIX and POSIX, "lpr" is used as the printer file, and "p" is the mode. For VMS, "SYS$PRINT" is used as the printer file, and "w" is the mode. You can change this with:

void se_printer(filename, dmode)
 
UCHAR *filename;
/* Printer file name
*/
UCHAR *dmode;
/* Disk mode for opening printer file
*/

The dmode parameter specifies whether the file is to be opened in the "w" mode, which overwrites the contents of the specified file, or "a" mode, which appends the copied information to the existing information in the file. For UNIX systems, you can specify "p" for dmode to open a pipe to the shell command specified as the filename. These are the same arguments used in the fopen() call. See your compiler manual for more information.

When the system is set to use a keyword section, mf_print() will write only that keyword section out to the printer file. If your memory file contains keywords, and you want to print the entire memory file, call mf_kwdset(NULLP, mfp) before calling mf_print(). Calling mf_kwdset() with a NULLP for the keyword string will force the system to operate on the entire memory file, not just on a single keyword.

When the memory file uses automatic or manually-loaded keywords, mf_print() writes only the information that is currently in memory. Calling mf_kwdset(NULLP, mfp) as described above will cause mf_print() to write out keyworded sections that are in memory, and index information for all other keyworded sections. Be careful when using this function on a file which contains automatic or manually-loaded keywords.


Home Contents Previous Next