fstream access issue, I think

This is a discussion on fstream access issue, I think within the C++ Programming forums, part of the General Programming Boards category; Hello, My fstream.operator!() keeps coming up true right after opening the file. The path is valid and, as far as ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    891

    fstream access issue, I think

    Hello,
    My fstream.operator!() keeps coming up true right after opening the file.

    The path is valid and, as far as I know, my application should have access to it.

    In other words, why does this
    Code:
    std::fstream fs(fpath.c_str(), std::ios::binary);
    if(!fs) throw std::string("Bad file path.");
    Keep throwing for me, regardless of what file fpath specifies? I'm running this in Vista, and I have the application set to run under administrator privileges.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Stupid idea. But did you specify how the fstream would access the file? std::ios::in, std::ios::out?
    Sorry for the most likely stupid reply.

  3. #3
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    891
    Not a stupid reply. I was just being silly.
    I thought flags = arg | default, but flags = arg. That does make more sense.

    Thanks, that fixed it.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to access struct fields in array
    By dv007 in forum C++ Programming
    Replies: 3
    Last Post: 01-18-2006, 08:51 AM
  2. MS Access Databases 2003
    By xddxogm3 in forum Tech Board
    Replies: 7
    Last Post: 11-27-2005, 03:52 PM
  3. Cannot access pointers from an array
    By Datamike in forum C++ Programming
    Replies: 4
    Last Post: 11-05-2005, 01:16 AM
  4. accessing a database made in Access..
    By willc0de4food in forum Windows Programming
    Replies: 4
    Last Post: 10-10-2005, 07:40 PM
  5. FtpFileFind access violation with MS VC++ 6.0
    By earth_angel in forum C++ Programming
    Replies: 3
    Last Post: 09-22-2005, 07:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21