逐行读取文本本件一例

来源:互联网 发布:打码自动识别软件 编辑:程序博客网 时间:2024/05/16 11:24
 #include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>

using namespace std;

int main()
{
ifstream infile;
    infile.open ("tsest.txt", ifstream::in);

if(!infile)
{
     cout << "wrong filename" << endl;
     system( "PAUSE" );
     return 0;           
    }

    char result[500];
    while(infile.getline(result,500))
{
cout << result << endl;
}
    
    system( "PAUSE" );
    return 0;
原创粉丝点击