(BEGINNERS)Possible REASONS for Unexpected program termination.

Discussion in 'C' started by jose_peeterson, Aug 5, 2012.

  1. jose_peeterson

    jose_peeterson New Member

    May 19, 2011
    Likes Received:
    Trophy Points:
    This post is for BEGINNERS only!
    hey guys,
    I am doing a small project currently and by experience i have figured out some possible reasons for why a program might quit unexpectedly without giving errors.

    Please ignore the details, only sift through to know the reasons behind the errors. thank you.

    Program terminates unexpectedly because of not typing in 5 strings for ADD Items or OLD saved items in items.txt does not have 5 typed strings in the same line.
    This happens all because strtok is called when the sentence less than 8 strings has no strings for strtok() to chop.

    Program terminates unexpectedly or cannot load from text file to structure. The problem is the string length allocation. Don't forget to include the null terminating character into the length of the string.
    Program terminates unexpectedly because of %S not being supplied with string.
    e.g. printf("\n>> %s is NOT in the ITEM Records");

    ERROR: cannot convert `bool' to `const char*' for argument `1' to `int strcmp(const char*, const char*)'

    if(strcmp((item_call_no,(item).call_no) == 0) && (strc("hello",(item).availability) == 0)) solution: have to use nested if one after another, == 0 for both stcmp
    Program terminates unexpectedly because the string to CONCATENATE/COPY is NOT Cleared.
    Use string1[0] = '\0' to clear.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice