avoid sprintf and strcpy with flex arrays