*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> DtMsgLogOpenFile (3)              
Title
Content
Arch
Section
 

Contents


 DtMsgLogOpenFile(library call)               DtMsgLogOpenFile(library call)




 NAME    [Toc]    [Back]
      DtMsgLogOpenFile - opens a log file

 SYNOPSIS    [Toc]    [Back]
      #include <Dt/MsgLog.h>
      FILE* DtMsgLogOpenFile(
      const char* type,
      char** filename_return);

 DESCRIPTION    [Toc]    [Back]
      The DtMsgLogOpenFile function calls fopen to open a log file with type
      open mode. If fopen opens a log file successfully and returns a nonNULL
 filename_return, DtMsgLogOpenFile calls malloc to allocate space
      for filename_return.  DtMsgLogOpenFile then copies the log file name
      to filename_return.

      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 in doing this
      because stderr may be returned.

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

 ARGUMENTS    [Toc]    [Back]
      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    [Toc]    [Back]
      None.

 RESOURCES    [Toc]    [Back]
      None.

 ACTIONS/MESSAGES
      None.

 ERRORS/WARNINGS
      None.

 EXAMPLES    [Toc]    [Back]
      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.





                                    - 1 -       Formatted:  January 24, 2005






 DtMsgLogOpenFile(library call)               DtMsgLogOpenFile(library call)




      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);

 RETURN VALUE    [Toc]    [Back]
      If DtMsgLogMessage completes successfully, it returns a pointer to the
      opened log file.  If it cannot open a log file, it returns stderr.

 FILES    [Toc]    [Back]
      None.

 SEE ALSO    [Toc]    [Back]
      DtMsgLogMessage(3), DtMsgLogSetHandler(3)


                                    - 2 -       Formatted:  January 24, 2005
[ Back ]
      
      
 Similar pages
Name OS Title
ffopen IRIX Opens or closes a file using flexible file I/O
MrmOpenHierarchyFromBuffer HP-UX Allocates a hierarchy ID and opens a buffer containing a memory image of a UID file
DtMmdbOpenInfoLib HP-UX opens an infolib for service
CDopen IRIX opens a CD-ROM drive for audio use
DXmSvnAddEntries Tru64 Opens new entries in the structure.
editobj IRIX opens an object definition for editing
sem_open Tru64 Opens/creates a named semaphore for use by a process (P1003.1b)
clone HP-UX opens a major and minor device pair on a STREAMS driver
clone Tru64 Opens a major and minor device pair on a STREAMS driver
shm_open Tru64 Opens a shared memory object, creating the object if necessary (P1003.1b)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service