C++ abrupt termination

C and C++ Programming Resources Forums C Programming C++ abrupt termination

This topic contains 8 replies, has 3 voices, and was last updated by  deepaksancheti 9 years, 4 months ago.

  • Author
    Posts
  • #2074

    Deepak
    Member

    heyyy geeks…
    i m a learner in OOP C++ programming…
    d problem dat i m facing is the abrupt termination of C++ when i execute a program…let me explain in detail..

    wen
    i run a program..smtimes it runs well and fine widout any problem…but
    wen i exit the program the TC.exe terminates abruptly sad.gif ….(it also hapens at time wen a fatal error occurs..hwever its natural… smile.gif )

    i
    thnk d reason behind mite be like dis : during d program
    execution…somehow d memory location of TC.exe mite be gettin
    overwritten by some or d other component of d program…however dis is
    my guess… lookaround.gif rolleyes1.gif smile.gif

    sooo…is dere neone who can help me out here ??? i want a perfect reason and a solution to that….
    smile.gif

  • #3347

    Same problem with me guyz…………………

    I think the reason is proper that the TC gets overwritten but how to overcome this problem?????

    Help us as soon as possible………

  • #3348

    msaqib
    Participant

    What operating system are you using?
    I worked on Win 98, 2000 and XP. turbo C/C++ compiler has no problems while using on win98. But if you write code which try to directly access any I/O port like COM port, then it causes problems. Because win 2000 and XP has some restrictions on accessing these resources.

    So if this is causing the problem for you…then I would advise you to use either win98 or change your program in a way that can safely access I/O devices.

    Or you could explain any situation when your program crashed, was that TC.exe file itself or you were trying to compile and run any program on TC?

  • #3349

    msaqib
    Participant

    Hello

    I have jsut compiled and run your program, and it works fine with me. I am using the same version of borland turbo c compiler on windows XP. It didn’t give me any errors or warning message and the program remained stable. Turbo C neither crashed nor closed with or without any warnings.
     
    What operating system do you use?

    Note:
    @Encrypted wrote:

    dis is my code…
    now wen i run it, it runs well nd fine…widout ne problems…
    but as sun as i exit it…instead of returnin to TC compiler, it jsts exits to d windows…
    soo…now if u hav gotta time for it…den pls check it out…
    nd giv me a reason nd solution…

    nd yaaa…i m using a Borland  Turbo C compiler of version 3.0….thot it mite help u…

    Please read the forums guidelines, as people would not understand this language,  it looks like some sort of chatting language :P
    But I would advise not to use it because it looks a bit odd and one can’t understand it easily.

  • #3350

    Deepak
    Member

    heyyy….thnx for advice bro… i wont use dem now onwards… :)
    nd i m usin windows XP SP2 ….
    hwever it ddnt wrk even in windows 2000 …
    nd 1 more thng…u r sayin its wrkn fine thru ur compiler….
    but i hav already run d code in 2-3 pcs…wid d same result…
    hw cm it workd in urs..?? nd wat abt ur OS ??
    nd wat has OS to do wid dis.??

  • #3351

    Deepak
    Member

    nd d message i m gettin is smthng like dis :

    16 bit MS-DOS Subsystem
    Turbo C++ IDE
    The NTVDM CPU has encountered an illegal instruction.
    CS:0066 IP:e5ea OP:f0 0b a8 09 00 Choose ‘Close’ to terminate the application.

    d register values changes at times…
    c if u get sm hint…

  • #3352

    msaqib
    Participant

    Hello

    Well it’s quite strange then, because I am using the same compile, OS version. Do you exit the program when you press ‘0’? And then press Enter kay to exit the program?

    I did the same thing, it worked fine here…

    May be anyone else might help you out here. For me this program works fine.

    I did not talk about smilies in the post, infact they are to show the feelings. I am talking about the language like

    @Encrypted wrote:

    nd i m usin windows XP SP2 ….
    hwever it ddnt wrk even in windows 2000 …
    nd 1 more thng…u r sayin its wrkn fine thru ur compiler

    You could have written it like
    and i am using windows xp SP2
    How ever it did not work even in windows 2000…
    and one more thing..you are saying its working fine through your compiles

    This way it looks quite readable.

    Thanks

  • #3353

    msaqib
    Participant

    Hey
    Yes I got the same error, this is not the compiler or OS error. Actually the variable choice in your program is of type int. And you use that variable to get the input from the user to make the decision and navigate through the menu. So now the problem is when enters character instead of an integer value, it crashes your program.

    So the solution to your problem is that you will have to check this input first, whether the choice is of type integer or character. If its of character type then ignore it, as you are doing cin.ignore(); but you will have to implement it properly. As cin.ignore(); ignores characters only.

  • #3354

    Assalamualaykum Mohammed Saqib….

    This is not the problem i think…. The Bhoot and I work together in a same institute…. Its also the same case with Char type choice i/p…

    So i think there must be something else behind this cumbersome problem.

You must be logged in to reply to this topic.