Thread: Dont make file?

  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    1

    Dont make file?

    ofstream cldb(nick, ios::noreplace);
    cldb<< nick << "\n" << name << "\n" << older << "\n" << live << "\n" << city << "\n" << info;
    cldb.close();

    Can someone say why this doesn't work?


    if i make a cout << cldb; it say "0x0" only...


    Thanks...

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    ALWAYS check if a file succeeded in opening

    Code:
    std::ofstream WriteFile;
    
    WriteFile.open(FileName, std::ios::out | std::ios::noreplace);
    if(WriteFile.good())
    {
       WriteFile << Stuff << ...;
       WriteFile.close();
    }
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM