各位高手帮看下哪错了,谢谢!
#include<stdio.h>#include<stdlib.h>
#include<string.h>
void fun(char *fname,char *st)
{
FILE *myf;
int i;
myf=fopen(fname,"w");
for(i=0;i<strlen(st);i++)
fputc(st[i],myf);
fclose(myf);
myf=fopen("fname","r");
for(i=0;i<strlen(st);i++)
printf("%c",st[i]);
printf("\n");
fclose(myf);
}
void main()
{
fun("test.txt","new world");
fun("test.txt","hello");
}