I\'m using a macro and I think it works fine -
#define CStrNullLastNL(str) {char* nl=strrchr(str,\'\\n\'); if(nl){*nl=0;}}
So it works to zero out the last
#define CStrNullLastNL(str) ({ \ char* nl=strrchr(str,'\n');\ if(nl){*nl=0;} \ nl; \ })
should work.
Edit: ... in GCC.