SET.MC - change media code of output file.

Usage:

B:
   ret = set.mc( [unit, ] media );
C:
   #equate set_mc set.mc
   int set_mc( [FILE *unit,] int media);

Where:

unit
is the number of an open output unit. If "unit" is not specified, the current write unit is used. If an invalid "unit" is specified, SET.MC does nothing.
media
is a word with the format "00000000mmrr" where "mm" are two octal digits in the range (0-17) specifying the new media code for this file and "rr" is two octal digits specifying the new report code for further records of this file.
ret
is zero if SET.MC is successful. If "unit" is not an open output file "ret" receives a value of -1.

Examples:

extrn wr.mc7;
...
set.mc( 1, 0772 );  /* force printer output in ASCII */

Description:

SET.MC is used to change the media and/or report code on the file described by "unit", until the file is closed or until another SET.MC is executed for the file.

Notes:

In order to minimize the load module size of ordinary B programs, routines to write output in media other than 6 are not normally loaded. To force loading of the appropriate group of routines, one must supply a statement of the form "extrn wr.mcN;" where N is the desired media code (0-7). For media code 10 (card image ASCII) use "wr.m10".

SET.MC can be quite handy for switching report codes, or for writing files such as object decks which have records of different media codes. However, it is recommended that wherever possible you specify the media code in the original call to OPEN.

SET.MC should only be called when you have finished outputting a complete record (e.g. after outputting an '*n', '*r' or '*f' character). If you call SET.MC to change media codes while in the middle of a record, the result is undefined.

See Also:

expl b lib open

expl b lib getmedia

expl b lib set.rc

Copyright © 1996, Thinkage Ltd.