Code:
void add_person(Control *c)
{
char line[1024];
char buff[1024];
if((file = fopen(filename,"r+")) == NULL)
{
error(app,"Could not open file main.add!");
}
fgets(buff,1024,file);
fputs(buff,file);
strcat(line,"<");
strcat(line,get_control_text(mainw.f_lname));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_fname));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_add));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_st));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_zip));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_home));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_work));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_cell));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_bd));
strcat(line,"|");
strcat(line,get_control_text(mainw.f_rel));
strcat(line,">");
ask_ok(app,"TEST",line);
fputs(line,file);
fclose(file);
clear_boxes();
free(buff);
free(line);
}
when I add one person, I get this "<|||||||||>", but when I add another, I get "<|||||||||><|||||||||><|||||||||>".
Why?