Design Pattern Examples
Overview of object-oriented design patterns
helpers/formatstring.h File Reference

Declaration of the formatstring() function that replaces sprintf() and snprintf() by allocating the right-sized buffer and returning it. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __FORMATSTRING_H__
 

Functions

char * formatstring (const char *format,...)
 Use the given string and arguments to return a buffer containing the formatted string. The format and arguments follow the printf() functionality.
 

Detailed Description

Declaration of the formatstring() function that replaces sprintf() and snprintf() by allocating the right-sized buffer and returning it.

Definition in file helpers/formatstring.h.

Macro Definition Documentation

◆ __FORMATSTRING_H__

#define __FORMATSTRING_H__

Definition at line 8 of file helpers/formatstring.h.

Function Documentation

◆ formatstring()

char * formatstring ( const char *  format,
  ... 
)

Use the given string and arguments to return a buffer containing the formatted string. The format and arguments follow the printf() functionality.

Parameters
formatString containing formatting codes as used with the printf() function.
Returns
Returns a newly allocated buffer containing the zero-terminated formatted string. Use free() to delete the buffer. Returns NULL if no memory could be allocated.

Definition at line 15 of file formatstring.c.

Referenced by _Bridge_Exercise_Demonstrate_Logging(), _Decorate(), _Real_DoWork(), Composite_Exercise_FormatEntry(), Memento_ApplyReplaceOperation(), Message_ToString(), MessagePosition_ToString(), MessageWindow_ToString(), and WindowRectangle_ToString().