Thread: Open a file, read it ... and ... read it again

  1. #1
    Registered User Tiago's Avatar
    Join Date
    Oct 2009
    Lisbon, Portugal

    Open a file, read it ... and ... read it again

    After reading a file how do we manage to put the file pointer back to the beginning of the file?

    Last edited by Tiago; 04-17-2010 at 03:32 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    rewind(fp), where fp is the FILE pointer.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed