在手机上可以用c创建文件吗?
c4droid吧
全部回复
仅看楼主
level 4
宇智贼 楼主
在手机上怎样创建文件,求大神指点!
2013年12月29日 07点12分 1
level 8
可以
2013年12月29日 08点12分 2
level 8
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
char filename[20],ch;
printf("Please input the filename you want to write:\n");
scanf("%s",filename);
if(!(fp=fopen(filename,"wt+")))
{
printf("Error!!");
exit(0);
}
printf("Please input what you want to write:\n");
ch=getchar();
ch=getchar();
while(ch!=EOF)
{
if(!(fputc(ch,fp)))
{
printf("Input error\n");
}
ch=getchar();
}
fclose(fp);
return 0;
}
2013年12月29日 08点12分 3
非常感谢!我试了一下,真的可以!
2013年12月29日 08点12分
1