dnf一登 就蓝屏 怎么办
额,我只会C语言,不过C++对C完全兼容,这个也可以用的。
1.
#include<stdio.h>
#include<string.h>
FILE *p;
char a[]="Hello world";
if((p=fopen("hello.txt","w"))==0)
{
printf("无法创建hello.txt,请检查原因“):
exit(0);
}
fwrite(a,strlen(a),1,p);
fclose(p);
printf("Done\n");
}
2.
#include<stdio.h>
#include<string.h>
FILE *p;
char a[20];
short i;
if((p=fopen("hello.txt","r"))==0)
{
printf("无法读取hello.txt,请检查原因“):
exit(0);
}
fread(a,20,1,p);
fclose(p);
printf("%s\n",a);
printf("Done\n");
}...
17929