我有以下代码,它工作得很好(除了它很慢的事实,但我不太在意)。这似乎并不直观,它会将整个infile的内容写入outfile。 // Returns 1 if failed and 0 if successful
int WriteFileContentsToNewFile(string inFilename, string outFilename)
{
ifstream infil
我想让我的文件解析更健壮。使用ifstream,我如何确保seekg让我在文件中的有效位置? 这不起作用: while(m_File.good() && m_File.peek() != EOF)
{ ...a seekg operation moves file position past end of file... }
我假设当前迭代器已被推方式过去结束迭代,所以偷看()是不正确的。