Thread: files files files

  1. #1
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    files files files

    i can like do stuff wit file using
    std:fstream filenamehere(dirgoeshere)
    but is there ne need to close a file opened for memory and sharing
    and how wud i if needed

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    filenamehere.close();

    It always pays to be tidy. For example, some OS's are "supposed" to delete an allocated memory that isn't deleted at the end of a program. But, would you rather take the risk or add the extra line of code.

  3. #3
    Unregistered
    Guest
    I think fstream's close() member is called anyway in the destructor, but I may be wrong.

  4. #4
    It probably does, since I forgot to call close one time, and I still was able to open it, and if you don't close a file, windows barfs up some access denied errors.

  5. #5
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    ty

    thanks u guys(and gals if ne lol)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ressources files
    By mikahell in forum Windows Programming
    Replies: 4
    Last Post: 06-19-2006, 06:50 AM
  2. add source files to embedded VC 4.0
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 03:28 AM
  3. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  4. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  5. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM