Thread: file opening problem

  1. #16
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by bigmac(rexdale) View Post
    oh ok, so fclose after i return fp? and i made the changes
    ...no. Once you return, your function is done. return() does just that - it returns the execution flow back to the calling function.

    You do not fclose() at all. That's the calling function's job.

  2. #17
    Registered User
    Join Date
    Oct 2007
    Posts
    118
    Quote Originally Posted by Lithorien View Post
    ...no. Once you return, your function is done. return() does just that - it returns the execution flow back to the calling function.

    You do not fclose() at all. That's the calling function's job.
    oh, thanks man helped me out alot

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    OK this is strange, you are using all C in your project.
    Are you supposed to do that? This is C++, so...
    You are reading with scanf in a very unsafe way, but you could easily fix that by using the "correct" C++ model instead.
    Or are you going to keep on using C? I'm wondering here...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM