creating + using files

This is a discussion on creating + using files within the C++ Programming forums, part of the General Programming Boards category; Could someone please tell me how to create a file with the name of a variable. For example, if a ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    2

    Question creating + using files

    Could someone please tell me how to create a file with the name of a variable.
    For example, if a user inputted their username to create an account, how could i make a file [theirusername].acc ?

    So basically, how do you use a variable, like a string, to access/create a file.
    Unfortunately I am forced to use the family comp. so I'm not allowed to install a compiler heh
    would
    char username[] = "example";
    then create a username.acc

    create username.acc or example.acc?

    Thanks.

  2. #2
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    With the code you posted and the question that you asked, I would say: no.

    And since you have no compiler installed, it would be hard to do any code.......

    But to give you an idea...
    First take input of a "username" and store that into a variable.
    Then take that variable and add the extention that you want.
    Create the file.
    Finaly write to the file.

    My sugestion would be to get a computer, compiler and read up on I/O.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  2. creating multiple files
    By lime in forum C Programming
    Replies: 8
    Last Post: 01-01-2004, 02:55 PM
  3. Creating text files
    By Crash1322 in forum C++ Programming
    Replies: 4
    Last Post: 12-15-2003, 09:55 PM
  4. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-20-2003, 09:12 PM
  5. reinserting htm files into chm help files
    By verb in forum Windows Programming
    Replies: 0
    Last Post: 02-15-2002, 09:35 AM

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