You can write the contents of a memory file to a standard ASCII disk file with the "memory-file write" function, mf_wr():
|
||
|
|
|
|
|
|
|
|
|
Specify "w" for the disk mode if you want to erase the contents of the file before writing the memory file to it. Specify "a" if you want to append the contents of the memory file to the existing contents, if any, of the disk file. For UNIX and POSIX systems, you can specify "p" for dmode to open a pipe to the shell command specified as the filespec. These are the same arguments used in the fopen() call. See your compiler manual for more information.
If the disk file does not exist, it will be created. Each non-empty row of the specified memory file will be written as a line in the specified disk file.
When writing the memory file contents to the ASCII file, spaces are compressed to tab characters 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().
Caution: When the system is set to use a keyword section, mf_wr() will write only that keyword section out to the disk file. If the disk file contains other information, that information will be lost. If you are using mf_wr() to update the contents of the disk file that contains your memory file, and if the memory file contains keywords, be sure to call mf_kwdset(NULLP, mfp) before calling mf_wr(). 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.
Caution: When the memory file uses automatic or manually-loaded keywords, mf_wr() writes only the information that is currently in memory. Calling mf_kwdset(NULLP, mfp) as described above will cause mf_wr() 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.
Note: Because of the C convention of using the backslash to introduce special characters (such as '\t' for tabs), use two backslashes in PCDOS path names (e.g., "c:\\temp\\screen.txt").