/*ca76a_c++_流文件打开输入输出文件模式 利用文件流打开文件进行输入与输出时的选项 in、out、app(附加模式)、ate((end)文件打开后,定于文件结尾)、trunc(裁剪)、binary(二进制)、、、、、 文件模式组合 out out|app out|trunc in in|out int|out|ate int|out|trunc
welcome to discuss txwtech@163.com */
/*ca76a_c++_流文件打开输入输出文件模式
利用文件流打开文件进行输入与输出时的选项
in、out、app(附加模式)、ate((end)文件打开后,定于文件结尾)、trunc(裁剪)、binary(二进制)、、、、、
文件模式组合
out
out|app
out|trunc
in
in|out
int|out|ate
int|out|trunc
welcome to discuss
txwtech@163.com
*/
#include
#include
#include
using namespace std;
int main()
{
//ifstream读取文件内容
string s;
ifstream ifs("file1.txt",ifstream::in);//不写就是默认的文件模式in打开
//先判断,是否打开成功
if (!ifs)
{
cerr
关注
打赏