You may come across compiler warnings like:
"warning: ‘strncpy’ output may be truncated".
The following pragma statement suppresses these warnings;
#pragma GCC diagnostic ignored "-Wstringop-truncation"
You may want to add this one as well;
#pragma GCC diagnostic ignored "-Wformat-truncation"
And some compilers may 'complain' about the pragma statement itself;
/* * Disable these warnings */ #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wstringop-truncation" #pragma GCC diagnostic ignored "-Wformat-truncation"
Before you disable these warnings, make sure that strings are always NULL-terminated!