Well all I actually want to know in the first function - is he writing something before the username in :
if (!fseek(fp, 0L, SEEK_SET))
-->(here): if (fwrite(&len, sizeof(short), 1, fp))
return fwrite(cp, sizeof(char), len, fp);
and if you use all the fwrite statements after each other...