- IO
- 按行读取文件
ifstream ifs;
ifs.open(path,ios::in);
if(ifs.is_open())
{
char buf[1024] = {0};
while(ifs.getline(buf,sizeof(buf)))
{
std::string tmpStr = std::string(buf);
std::cout << tmpStr << std::endl;
}
}
ifs.close();

ifstream ifs;
ifs.open(path,ios::in);
if(ifs.is_open())
{
char buf[1024] = {0};
while(ifs.getline(buf,sizeof(buf)))
{
std::string tmpStr = std::string(buf);
std::cout << tmpStr << std::endl;
}
}
ifs.close();