clibs
Tiny but handy utility libraries for C
Macros
print.h File Reference

Console printing related macros. More...

#include <stdio.h>
Include dependency graph for print.h:

Go to the source code of this file.

Macros

#define END_OF_LINE   "\n"
 
#define PRINT(format, ...)
 Print formated string to stdout without trailing EOL. More...
 
#define PERROR(format, ...)
 Print formated string to stderr without trailing EOL. More...
 
#define PUTS(format, ...)
 Print formated string to stdout with trailing EOL. More...
 
#define PUTERR(format, ...)
 Print formated string to stderr with trailing EOL. More...
 
#define DEBUG_INFO(format, ...)
 Print formated debug message to stderr with trailing EOL. More...
 

Detailed Description

Console printing related macros.

Author
ByteBard

The macro definition seen in this document represent the platform data of Unix.

Macro Definition Documentation

◆ DEBUG_INFO

#define DEBUG_INFO (   format,
  ... 
)
Value:
{ \
fprintf(stderr, "(%s:%d) " format "%s", \
__FILE__, __LINE__, ##__VA_ARGS__, END_OF_LINE); \
}
#define END_OF_LINE
End of line of specific host.
Definition: platform.h:18

Print formated debug message to stderr with trailing EOL.

DEBUG_INFO works similarly to PUTERR but adds source file and line number. Hence, developers can track the location of the message more easily.

◆ PERROR

#define PERROR (   format,
  ... 
)
Value:
{ \
fprintf(stderr, format, ##__VA_ARGS__); \
}

Print formated string to stderr without trailing EOL.

PERROR works as PRINT, but to stderr.

◆ PRINT

#define PRINT (   format,
  ... 
)
Value:
{ \
fprintf(stdout, format, ##__VA_ARGS__); \
}

Print formated string to stdout without trailing EOL.

Basically, PRINT is just a repackaged printf function seen stdio.h.

◆ PUTERR

#define PUTERR (   format,
  ... 
)
Value:
{ \
fprintf(stderr, format "%s", ##__VA_ARGS__, END_OF_LINE); \
}
#define END_OF_LINE
End of line of specific host.
Definition: platform.h:18

Print formated string to stderr with trailing EOL.

The EOL will change according to the host environment.

◆ PUTS

#define PUTS (   format,
  ... 
)
Value:
{ \
fprintf(stdout, format "%s", ##__VA_ARGS__, END_OF_LINE); \
}
#define END_OF_LINE
End of line of specific host.
Definition: platform.h:18

Print formated string to stdout with trailing EOL.

The EOL will change according to the host environment.