Thread: making files needs fixing ;,,(

  1. #1

    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
    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
    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, 03: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
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM
  5. making files unrecoverable
    By *ClownPimp* in forum A Brief History of
    Replies: 4
    Last Post: 02-13-2002, 07:29 AM