The file content
Variable content 1 [space] [space]... [space] [space] variable content 2
Int test=30;//space number variable
Void fun (test);//call this function can be written test number space
My own test method:
Define a parameter macro
# define A (num) "% - # #" num "s"
Char line [200].
Char daybuff [200].//define two arrays
Sprintf (line, A (20), daybuff); //A () is the number can directly, just define A variable as A string handling
Fprintf (fp, line);//write file
//consult a big help, thank you
CodePudding user response:
With circulation fputc can't into space?Fprintf can also be ~
CodePudding user response:
Void fun (int test)
{
Char * buffer=(char *) malloc (test);
Memset (buffer, 0, ');
Fwrite (buffer, test, 1, fp);
Free (buffer);
}