trapping exit??

This is a discussion on trapping exit?? within the C Programming forums, part of the General Programming Boards category; i have a console app that when it exits it saves everthing to file, i use atexit() but this does ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    17

    Question trapping exit??

    i have a console app that when it exits it saves everthing to file, i use atexit() but this does not always work only if the app is terminated by running out of code, it does not work if the user simply closes the command window, is ther some way to do the same as atexit but for it to work when the window is closed??

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Do you know any win API? It wouldn't be too hard if you could use it.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    17
    could u give me a little more of a clue please

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    You would need to create ur window through API and when you get the close message in the wndproc, save the info. (that is my idea at least) If you have no clue what I am talking about, ignore this post.

  5. #5
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    i thought just closing the command window is terminating the program abnormally, that should invoke atexit()?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Chat Program Help?
    By Paul22000 in forum Networking/Device Communication
    Replies: 9
    Last Post: 02-09-2009, 11:35 PM
  2. Odd memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 05-25-2006, 12:56 AM
  3. Replies: 1
    Last Post: 03-21-2006, 06:52 AM
  4. Dynamic array of pointers
    By csisz3r in forum C Programming
    Replies: 8
    Last Post: 09-25-2005, 02:06 PM
  5. exit() ?
    By smd in forum C++ Programming
    Replies: 4
    Last Post: 06-26-2002, 04:31 PM

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