Since you have reached (and attempted to read past) the end of the file, the eof
and fail
flags will be set. You need to clear them using ifile.clear
– then try seeking:
ifile.clear();
ifile.seekg(0);
More Related Contents:
- C++ 11: conversion const int* to int* using unordered_set::push
- A confusing detail about the Most Vexing Parse
- Two different values at the same memory address
- Can I access private members from outside the class without using friends?
- What are the differences between struct and class in C++?
- system(“pause”); – Why is it wrong?
- How can I take a screenshot in a windows application?
- Do rvalue references to const have any use?
- c++ force std::cout flush (print to screen)
- Difference between iostream and iostream.h
- How to check if C++ compiler uses IEEE 754 floating point standard
- How to build and use Google TensorFlow C++ api
- I’ve heard i++ isn’t thread safe, is ++i thread-safe?
- How to programmatically cause a core dump in C/C++
- What destructors are run when the constructor throws an exception?
- Correct usage(s) of const_cast
- `auto` specifier type deduction for references
- TMP: how to generalize a Cartesian Product of Vectors?
- Undefined behavior causing time travel
- How do I use the MinGW gdb debugger to debug a C++ program in Windows?
- Questions about Hinnant’s stack allocator
- Why must I put a semicolon at the end of class declaration in C++?
- sprintf for unsigned _int64
- Unable to read frames from VideoCapture from secondary webcam with OpenCV
- Hashtable in C++?
- std::this_thread::sleep_for() and GCC
- Why is reinterpret_cast not constexpr?
- How to initialize all tuple elements by the same arguments?
- How to execute another exe from a C++ program in Windows
- How do I get crtdbg.h file?