文件IO - c++文本文件borland
file io - c++ textfile borland
我问在文本文件中的第k行中查找的函数和在c++中按行或按字符读取文本文件的函数!知道我在和borland合作。
fpeek是一个开源应用程序。检查来源,看看它是如何完成的。
我快速看了一下,我相信你最终会得到这样的东西(我还没有测试过这段代码):
std::ifstream file(filename);
std::string line;
int pos = 1;
while (std::getline(file, line))
{
// Find if current line should be displayed
if (15 == pos) // looking for the 15th line in the file
{
std::cout << pos << ": " << line << std::endl;
}
pos++;
}
相关文章:
- .cpp和.h文件中的模板专用化声明
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 文本文件中的单词链表
- CMake-按正确顺序将项目与C运行时对象文件链接
- 使用新行和不使用新行读取文件
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 挂起和取消挂起一个文件DLL
- 如何确定我已使用非编码文件到达 EOF?
- 命名空间中具有.h和.cpp文件的类
- 如何使用ndk-build.cmd构建Android.so文件
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 读取文件并输入到矢量中
- 在C++中查找文件
- c++库的公共头文件中应该包含什么
- Borland C++ 5.02 中使用第三方头文件的多线程
- Borland C++ - 使用OLE使用Word打开RTF文件
- Borland c++5.02文件处理问题
- Borland c++ Builder 6调整输出可执行文件大小,以适应屏幕
- 文件IO - c++文本文件borland
- 无法在 Borland C++ Builder 中打开包含文件'inttypes.h'