Thread: File creation

  1. #1
    Unregistered
    Guest

    Question File creation

    Now, i know how to create files in C++... but how do i create a file with the name the user wants?

    eg. ifstream f1 ("Userschoice");


    Note: i'm using Borland Turbo C++ 3.0 DOS

  2. #2
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    This should work:
    Code:
    ifstream(gamedata)
    istream("gamedata",ios::in)
    if (gamedata)
    {
      load >> stuff;
    }
    That should work.........

  3. #3
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    Quantrizi: i dont think that is what he wants

    this should do what you want..

    Code:
    ifstream fin;
    char fname[12];
    cin.getline(fname,12,'\n');
    fin.open(fname)
    --
    --
    -

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 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