Thread: not making sense

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    38

    Exclamation not making sense

    I am writing code that opens and reads from a file.
    In the code the user inputs file name to read, if file name not found
    then code is to ask user for correct file name

    In c++ a flag is set to give fail for finding file. The instructor emailed the class and told us to use this code
    Code:
    infile.clear
    to clear the flag

    I do this and yes it clears the flag but it also clears everything in the file that I am reading from.

    Is there another way to clear the flag, am i misunderstanding the instructor.

    I can get the program to do what it needs to do except for this error test.

    thanks

  2. #2
    Registered User
    Join Date
    Nov 2006
    Posts
    38
    fixed !!
    used
    Code:
    cout.clear()
    instead of
    Code:
    infile.clear()
    thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. making sprites
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 02-20-2010, 07:00 AM
  2. error help making no sense
    By tunerfreak in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2007, 07:55 PM
  3. Making great graphics
    By MadCow257 in forum Game Programming
    Replies: 1
    Last Post: 02-20-2006, 11:59 PM
  4. thinking about making a network traffic monitor
    By jimjamjahaa in forum C++ Programming
    Replies: 9
    Last Post: 10-13-2005, 11:38 AM
  5. Get sense of internal linkage and external linkage
    By gandalf_bar in forum C++ Programming
    Replies: 1
    Last Post: 10-14-2003, 05:57 AM