C++如果流打开许多文件
C++ ifstream open many files
如果我有大约 19 个txt
文件示例文件名: 13.txt
如何使用 C++ 中的 easy 方法按顺序打开txt
文件。感谢您解决此问题。
for(int i = 0; i < 100; ++i)
{
std::istringstream iss;
iss << i << ".txt";
std::ifstream ifs( iss.str().c_str() );
if(ifs) {
// Do something with ifs
}
}
它非常简单地创建与需要操作的文件一样多的ifstream对象。请注意,因为此任务是资源密集型的
相关文章:
- 为什么许多项目不提供预编译的二进制文件?
- 许多文件描述符在调用sys_clone时
- 哪个链接更快?许多小的 .so 文件还是几个大的 .so 文件?
- 使用 for 循环在 c++ 中写入许多文件
- 为许多类可能需要的所有常量变量制作独立的头文件是否是一种很好的做法?
- C :如何从格式的文本文件中读取许多数据到程序中
- C Wininet FTP列出了许多文件错误
- 为什么打开许多文件时"open file failed"?
- 用于许多C 可执行文件的makefile
- 从许多并行可执行文件写入单个文件的最佳方法
- 用G 和Make编译并链接来自不同文件夹的许多源文件
- 用C++快速编写许多大文件
- 当存在许多相互依赖的项目时,Visual C++中的文件夹结构
- 想要创建许多不同的文件,但使用不同的名称
- 编写 scons 脚本来处理许多子目录中的文件编译
- 在NTFS上打开许多小文件太慢了
- 为什么必须在 Linux 系统上"installed" uuid.h 才能构建许多C++程序,而不仅仅是放入 include 或 lib 文件夹
- C++如果流打开许多文件
- 如何使用SWIG包装许多.h文件并包含任何依赖项
- 读取子文件夹中的许多文件时出错