#include <stdio.h>
int my_fputs(char *s, FILE *fp);
int main(void)
{
char buf[100] = "Write string to file";
FILE *fp;
fp = fopen("e:/test.txt", "w");
my_fputs(buf, fp);
fclose(fp);
return 0;
}
int my_fputs(char *s, FILE *fp)
{
int c;
while ( (c = *s++) )
putc(c, fp);
return ferror(fp) ? EOF : 0;
}
/*
run:
check for the file: e:/test.txt
*/