File creation

This is a discussion on File creation within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Now, i know how to create files in C++... but how do i create a file with the name the ...

  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, 01: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, 01:58 AM

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