c - Appending a string on different lines of a file? -
i learning c , had question. trying append string file. however, every time string appended has on next line (sort of println instead of print).
i cannot make function append on next line. instead, keeps appending on same line. how do this?
void filewriter(char *cmmd) { file *fp; fp = fopen("xxx.txt", "a"); fprintf(fp, "%s", cmmd); fclose(fp); }
thanks!
say this:
fprintf(fp, "%s\n", cmmd); // ^^
Comments
Post a Comment