求各位帮我看一下这个函数,如何使其保存的数据不会多出空格和换行
void SaveFile(struct Table *SaveDate, unsigned n){
FILE *fp_rd = NULL;
fp_rd = fopen("F:\\SaveDate.txt", "wt+");
if (NULL == fp_rd)
{
ERROR("文件SaveDate.txt打开失败!");
}
else
{
INFO("文件SaveDate.txt打开成功!");
}
unsigned int i = 0;
for (; i<n; i++, SaveDate++)
{
//fprintf(fp_rd, " name age job");
fprintf(fp_rd, " %7s %4d %8s ",
SaveDate->name,
SaveDate->age,
SaveDate->job);
if ('S' == SaveDate->job[0] || 's' == SaveDate->job[0])
{
fprintf(fp_rd, " %12d\n",SaveDate->TeacherStudentEngineer.ClassCode);
}
else
if ('T' == SaveDate->job[0] || 't' == SaveDate->job[0])
{
fprintf(fp_rd, "%12s\n",SaveDate->TeacherStudentEngineer.Department);
}
if ('E' == SaveDate->job[0] || 'e' == SaveDate->job[0])
{
fprintf(fp_rd, "%12s \n", SaveDate->TeacherStudentEngineer.Duty);
}
}
i = fclose(fp_rd);
if (0 == i)
{
INFO("文件关闭成功!");
}
else
{
ERROR("文件关闭失败!")
}
}