making files needs fixing ;,,(

This is a discussion on making files needs fixing ;,,( within the Game Programming forums, part of the General Programming Boards category; I am currently working with a program that makes files and i am having a bit of a problem... FILE ...

  1. #1
    Unregistered
    Guest

    making files needs fixing ;,,(

    I am currently working with a program that makes files and i am having a bit of a problem...

    FILE *outfile = fopen(name, "w");
    // <-- it does not get past here, but still creates the file
    fprintf(outfile, "%s\n", pword);

    what am i doing wrong?? when the program gets to this point it crashes
    P.S. tell me if you need more info...

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    Just guessing some things that could be wrong, but is name a valid string? (Does it contain a null char at the end). You should validate the file was opened by checking to see if the file pointer is NULL.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Unregistered
    Guest
    i fixed it

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. Help with making a Makefile
    By Eavan Hyde in forum Linux Programming
    Replies: 5
    Last Post: 05-04-2004, 04:05 AM
  3. making a list of files
    By Stevo in forum Windows Programming
    Replies: 5
    Last Post: 11-02-2003, 03:45 AM
  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. making files unrecoverable
    By *ClownPimp* in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-13-2002, 07:29 AM

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