R
Rav
Hi everyone, i need help on this one. i have declared a structure as
struct record
{
int i;
int j;
char name[20];
char place[20];
};
struct record rec;
now, after creating multiple records of type 'rec' and assigining each
member the value, i want to generate a text report file in which each
record element of type 'rec' is displayed sequentially.
like, if rec.i = 10, rec.j=20, rec.name = "ravs" and rec.place =
"india" then the format of the record should be like,
i j name place
========================
10 20 ravs india
i tried to do that with the 'fprintf' function (e.g.
'fprintf(f_report,"%s",rec.name)' where f_report is a pointer of type
'FILE *' named 'report.txt') but i am not able to figure it out because
after printing any string member of 'rec'(e.g. rec.name), the next
member gets printed in next line, this is not what i want..i want all
the members to be printed in the same line. i have tried to remove this
but didn't succeed. plz help.
struct record
{
int i;
int j;
char name[20];
char place[20];
};
struct record rec;
now, after creating multiple records of type 'rec' and assigining each
member the value, i want to generate a text report file in which each
record element of type 'rec' is displayed sequentially.
like, if rec.i = 10, rec.j=20, rec.name = "ravs" and rec.place =
"india" then the format of the record should be like,
i j name place
========================
10 20 ravs india
i tried to do that with the 'fprintf' function (e.g.
'fprintf(f_report,"%s",rec.name)' where f_report is a pointer of type
'FILE *' named 'report.txt') but i am not able to figure it out because
after printing any string member of 'rec'(e.g. rec.name), the next
member gets printed in next line, this is not what i want..i want all
the members to be printed in the same line. i have tried to remove this
but didn't succeed. plz help.