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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -