i want to write into a file like this:
someText
{
"Bob [m]" -> "Fed [m]";
"Tom [m]" -> "Jenny [f]";
...
}
i have:
void file Write()
{
FILE *fp;
fp = fopen("df.dot", "w");
int i;
fputs("someText\n", fp);
fputs("{\n", fp);
for (i = 1; i < 6; i++)
{
printf(" \"%s\" -> \"%s\";\n", sort[i].sorted1, sort[i].sorted2);
}
fputs("}\n", fp);
fclose(fp);
}
The problem is the part with the for loop. The place where the fprints is located, it also has to be written with fputs. (fputs instead printf)
I think it is not possible, to do it this way with fputs. Is there another function() which makes this possible?
Thanks
In your for loop you used printf. You can use fprintf instead. Or you can format string with sprintf function and then write formated string using fputs.