Dont make file?

This is a discussion on Dont make file? within the C++ Programming forums, part of the General Programming Boards category; ofstream cldb(nick, ios::noreplace); cldb<< nick << "\n" << name << "\n" << older << "\n" << live << "\n" << ...

  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, 11:39 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04: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

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