Thanks for the suggestion, I did not know about asprintf. I thought it was my invention. ;-) Of course, I would like to use asprintf. But rprintf is still required to check the status returned by asprintf. I am not sure how to define _GNU_SOURCE macro. I done it with #define in the source. Ok, here is the attempt #2: