如何在c中用空格或逗号分隔的文件中写两个字符串?

muj*_*hid 1 c file-io file file-handling

我有两个字符串,我想以下列格式将这些字符串写入FILE:

string1 "space/comma" string2 "newline"
string3 "space/comma" string4 "newline"
..
..
..
Run Code Online (Sandbox Code Playgroud)

Mar*_*tin 5

FILE* fileptr = fopen("file.txt","wt");
fprintf(fileptr,"%s , %s \n",string1,string2);
Run Code Online (Sandbox Code Playgroud)