putmsg() extensions: fixmmsgfh, closemmsgfh


void closemmsg(void)

void fixmmsgfh(void)

These are some useful extensions to the putmsg() family of functions that provide more flexibility to programmers. They are not used directly by the Metamorph 3 API.

closemmsg() closes the message file and should be called before exiting any application that uses putmsg() or the Metamorph 3 API. It may also be called in the middle of an application to flush the message file buffers to disk or force the message file to be reopened on the next call to putmsg(). If mmsgfh is stderr, it will not be closed, but the next putmsg() call will still force a reopen. It is safe to call closemmsg() at any time because it will not attempt to close a file that is already closed or has never been opened.

fixmmsgfh() is called by putmsg() before any output is attempted. It guarantees that mmsgfh points somewhere legal based on mmsgfname. See "Output destination" in the putmsg() description. fixmmsgfh() will probably not be needed by API users because putmsg() supplies ample output functionality.

If you use any of these functions and replace putmsg() you will have to write your own replacements for the extensions. All of the putmsg() functions are in the same object module within the library. Therefore, calling any one of the functions will cause all of them to be brought in by the linker, which will then cause a clash if you have your own version of putmsg().


putmsg() replacement

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.