Thread: file...

  1. #1
    /*enjoy*/
    Join Date
    Apr 2004
    Posts
    159

    Red face file...

    hello

    i'm new in c++ programming

    Code:
    int main()
    {
    char m[20];
    fstream file("c:\\test\\test.txt",ios::ate | ios::out | ios::in )
     /* i want a function to create test if doesn't exist */ 
    get(m)
    file << m;
    file.close();
    sorry about my english because i unse a translator

  2. #2
    Compulsive Liar Robc's Avatar
    Join Date
    Jul 2004
    Posts
    149
    If you open the file for writing or update then a nonexistent file is created if possible. That means if you use ios_base::out at all in the mode and the file doesn't exist, the program will attempt to create it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM
  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