Writing the Memory Screen Contents to a Disk File

To write the character contents of a memory screen to a disk file, call the memory screen write function, ms_wr():

int ms_wr(filespec, dmode, msp)
 
UCHAR *filespec;
/* Path (optional) and filename of file
*/
UCHAR *dmode;
/* Disk mode, "a", "w", or "p"
*/
SCRPTR msp;
/* Memory screen to write
*/

Specifying "a" for the disk mode means that the memory screen contents will be appended to end of the disk file. Specifying "w" means that the contents of the memory screen will replace the current contents of the specified 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.

ms_wr() writes an ASCII file. No attributes are stored in the file.

When writing the window contents to the file, tabs are compressed 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().

Note: Because of the C convention of using the backslash as an escape character to introduce special characters (such as '\t' for tabs), use two backslashes in PCDOS path names (e.g., "c:\\temp\\screen.txt").


Home Contents Previous Next