📅  最后修改于: 2022-03-11 15:04:38.555000             🧑  作者: Mango
#include
#include
#include
#include
void my_write(FILE *fp, char *str)
{
fprintf(fp, "%s", str);
}
int main(void)
{
char *str = "test text\n";
FILE *fp;
fp = fopen("test.txt", "a");
if (fp == NULL)
{
printf("Couldn't open file\n");
return 1;
}
my_write(fp, str);
fclose(fp);
return 0;
}