DTMSGLOGOPENFILE(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’– DtMsgLogOpenFile β€” the log-file-opening bestie πŸ’–

okay so this is the library call manual page for DtMsgLogOpenFile, and if you've ever been like β€œwhere is this program even logging??” β€” bestie, same. This function opens a log file. That's the assignment. Slay. ✨

✨ NAME ✨

DtMsgLogOpenFile β€” opens a log file

🌸 SYNOPSIS 🌸

       #include &<Dt/MsgLog.h>
       FILE* DtMsgLogOpenFile(
       const char* type,
       char** filename_return);

bestie, the &<Dt/MsgLog.h> is exactly what the page has. Do not come for me. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

So DtMsgLogOpenFile calls fopen to open a log file with type open mode. If fopen opens a log file successfully and returns a non-NULL filename_return, then DtMsgLogOpenFile calls malloc to allocate space for filename_return. After that, it copies the log file name to filename_return. Iconic behavior, no cap. 🌈

The caller must use the free function to release the space allocated for filename_return, if it is not NULL. The caller must also close the file pointer returned by DtMsgLogOpenFile. Use caution doing this because stderr may be returned. Like, actual caution, bestie β€” not decorative caution. 😭

For a description of the algorithm used to determine the log file to open, see DtMsgLogMessage(3). Also note: if a log file cannot be opened, filename_return will be set to NULL.

πŸŽ€ ARGUMENTS πŸŽ€

  • type β€” Specifies the file open flag. See fopen(3) for more information.
  • filename_return β€” Specifies the variable to receive the returned log file name.

🌈 ENVIRONMENT VARIABLES 🌈

None.

⭐ RESOURCES ⭐

None.

πŸ’œ ACTIONS/MESSAGES πŸ’œ

None.

πŸ“ ERRORS/WARNINGS πŸ“

None.

πŸ”₯ EXAMPLES πŸ”₯

The following code fragment opens the log file, logs the log file name, closes the file, and frees the space allocated for the file name.

       char * log_file;
       FILE * fp = DtMsgLogOpenFile ("a+", &&log_file);

       if (log_file) {
           DtMsgLogMessage (argv[0], DtMsgLogInformation,
                 "The log file name is: %s", log_file);
           free (log_file);
       }
       if (fp &&&& fp != stderr)
            fclose (fp);

Copy that exactly as printed, bestie β€” the &&log_file and &&&& are giving β€œdo not edit the sacred text” energy. πŸ™ˆ

πŸ‘‘ RETURN VALUE πŸ‘‘

If DtMsgLogMessage completes successfully, it returns a pointer to the opened log file. If it cannot open a log file, it returns stderr. Yes, the page really says DtMsgLogMessage in this return-value sentence β€” I am preserving it exactly, not doing a little autocorrect moment. πŸ’€

🧚 FILES 🧚

None.

πŸ’« SEE ALSO πŸ’«

DtMsgLogMessage(3), DtMsgLogSetHandler(3)


okay that's the whole thing. Source/version footer vibe: DtMsgLogOpenFile(library call). Date: this page doesn't show one, so I'm not inventing a date β€” we don't do fan fiction in manpages, bestie πŸ’…πŸŽ€

πŸ“¦ where this page comes from