📄 流文件的打开和关闭.cpp
字号:
#include<iostream.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
main()
{
FILE *fp1;
char str[80];
cout<<"Input a string:";
cin.getline(str.80);
if((fp1=fopen("d.dat","w"))==NULL)
{
cout<<"\nCould not open the file."<<endl;
cout<<"Exiting program."<<endl;
exit(1);
}
fputs(str,fp1);
fputs("\n",fp1);
fclose(fp1);
if((fp1=fopen("d.dat","r"))==NULL)
{
cout<<"\nCould not open the file ."<<endl;
cout<<"Exiting program."<<endl;
exit(1);
}
char ch;
while ((ch=fgetc(fp1)!=EOF)
cout<<ch<<endl;
fclose(fp1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -