Thread: Parsing text files.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    Quote Originally Posted by IceDane View Post
    Why are you using exit(1)? If I'm not incorrect, it simply terminates right then and there, and doesn't clean up the stack or anything. This means your file object is leaking memory in case of failure.

    If it doesn't affect stack objects in the nearest scope, then it definitely affects everything else.
    On top of that, it's pointless. You can just throw a return in there, and the stack frame gets cleaned up properly.

    I know it might be a big issue in this particular program, but seeing as you used it two times in this very small program, where you should/could have used return, it looks like you have a bad habit that you shouldn't be teaching others. No offense.
    exit - C++ Reference

  2. #2
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by valaris View Post
    Oops. My bad. I guess I should have checked that out before going with something someone had told me.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    2
    Thanks a lot, strange. That's exactly what I was looking for. You were a big help.
    Is there a name for this?
    Last edited by mwesclark; 12-10-2009 at 08:52 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help creating multiple text files
    By Tom Bombadil in forum C Programming
    Replies: 19
    Last Post: 03-28-2009, 11:21 AM
  2. Replies: 5
    Last Post: 02-11-2008, 01:36 AM
  3. Parsing Text File and gathering input variables
    By azamsharp1 in forum C Programming
    Replies: 2
    Last Post: 10-26-2005, 08:43 AM
  4. pointers into largish text files
    By donkeypunch in forum C++ Programming
    Replies: 8
    Last Post: 06-30-2004, 03:04 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM