Thread: ios::nocreate

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    5

    Wink ios::nocreate

    Help wanted !

    What wrong with the following code
    file.open(pFileName, ios::in | ios::nocreate);

    When compiling, the compiler have an error of "nocreate is not a member in ios" .
    I do not know what wrong with the code on ios::nocreate.

    When using MS C++ compiling
    I can replace the code with
    file.open(pFileName, ios::in | 0x40);
    It can be compiled with no error. But using dev C++, it cannot.

    Thank you

    lshome

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Iv'e had to deal with this recently as well. Include <ios.h> and this will go away. Kinda stupid in my opinion to need to include this file just to be able to use nocreate, after all, you don't need it for ios::in or ios::out but suddenly try and use ios::nocreate and the compiler flakes out on you. Sheesh!

    [edit]Wait a minute, this fix was for MSVC++ 6.0 I don't know if it will work using that other compiler.[/edit]
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    ios::nocreate doesn't exist anymore. If you have an up-to-date standards-compliant compiler, it will not find it. Check out this thread: http://cboard.cprogramming.com/showt...light=nocreate
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ios::nocreate and the latest standard
    By Magos in forum C++ Programming
    Replies: 6
    Last Post: 12-07-2003, 10:53 AM