that is  still  an accident waiting to happen  and really ugly verbose code this kind of thing is what asprintf  or  since this is actually c and you need to string a bunch of these together anyway  android  base  stringprintf and std  string operator  is for just say no to fixed length buffers 