#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
void my_write(FILE *fp, char *str)
{
fprintf(fp, "%s", str);
}
int main(void)
{
char *str = "test text
";
FILE *fp;
fp = fopen("test.txt", "a");
if (fp == NULL)
{
printf("Couldn't open file
");
return 1;
}
my_write(fp, str);
fclose(fp);
return 0;
}