mattias1975
Programmer
My program is supposed to write some char[] in a struct to a file.
It works but the program also add some other crap characters to the file that i dont want to have.
Why? And how do i fix it?
Thak you.
The program looks like this:
FILE *reg;
reg = fopen("/home/cproject/register.dat","w");
fputs (post.a, reg);
fputc ('\n', reg);
fputs (post.b, reg);
fputc ('\n', reg);
fputs (post.c, reg);
fputc ('\n', reg);
fputs (post.d, reg);
fputc ('\n', reg);
fputc ('\n', reg);
fclose(reg);
It works but the program also add some other crap characters to the file that i dont want to have.
Why? And how do i fix it?
Thak you.
The program looks like this:
FILE *reg;
reg = fopen("/home/cproject/register.dat","w");
fputs (post.a, reg);
fputc ('\n', reg);
fputs (post.b, reg);
fputc ('\n', reg);
fputs (post.c, reg);
fputc ('\n', reg);
fputs (post.d, reg);
fputc ('\n', reg);
fputc ('\n', reg);
fclose(reg);