Thread: ---->help With Opening External Files<-----

  1. #1
    Registered User
    Join Date
    Apr 2002

    Question ---->help With Opening External Files<-----

    I need a way for the user to enter a file name and i am able to open it with in the loop i am doing something like
    fopen ("%s", file_name, "r");

    thanks for the help

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    What you need to do is store the file name into a string and then open that string.

    char FileName[128] = "test.txt";
    FILE *infile = fopen(FileName, "r");

    This will open the file. You do not need to use "%s" like you do in printf.
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM
  5. Ask about these "unresolved external symbol" error
    By ooosawaddee3 in forum C++ Programming
    Replies: 1
    Last Post: 06-29-2002, 11:39 AM