The header file <pgmspace.h> defines a number of functions written to be compatible with the corresponding file in IAR’s Embedded Workbench for AVR products EWA90 and EWAVR.

IAR's header file uses the suffic “_P” to indicate that constant strings are stored in program (code) space rather than data space. CrossWorks for AVR uses the suffix “_c” to indicate the same, so this header file defines macros ending in “_P” that expand to the equivalent CrossWorks for AVR function names. For instance, this header file defines the IAR-compatible function named printf_P like this:

#define printf_P printf_c

The following are the macros which are defined by this header file:

Formatted input functions
scanf_P Read formatted text from standard input
sscanf_P Read formatted text from a string
vscanf_P Read formatted text from standard input using a va_list argument
vsscanf_P Read formatted text from a string using a va_list argument
Formatted output functions
printf_P Write formatted text to standard output
snprintf_P Write formatted text to a string with truncation
sprintf_P Write formatted text to a string
vprintf_P Write formatted text to standard output using a va_list argument
vsnprintf_P Write formatted text to a string with truncation using a va_list argument
vsprintf_P Write formatted text to a string using a va_list argument
Copying functions
memcpy_P Copy memory
strcpy_P Copy string
strncpy_P Copy string up to a maximum length
Concatenation functions
strcat_P Concatenate strings
strncat_P Concatenate string up to a maximum length
Comparison functions
memcmp_P Compare memory contents
strcmp_P Compare strings
strncmp_P Compare strings up to a maximum length
Miscellaneous functions
puts_P Write a string to standard output
strlen_P Calculate length of string