Ugh, after you fix what qny pointed out, there's still the thing that calling strcat in a loop like that sucks for performance because strcat has to keep finding the null character and then appending...