From: Zenja Ivkovic >p_debug("Reading data from file.."); >fgets(buf, 80, fl); >if(sscanf(buf, "%d %d %d", balance, owe, due) != 3) > f_error("Format error reading data from input file."); >sprintf(buf2, "Got %d for balance, %d for money owed, and %d for money due >for pay.", balance, owe, due); >p_debug(buf2); > >It compiles fine but the error is in run-time. The program outputs the >"Reading date from file.." part as my function tells it to, reads a line >from the file into 'buf', but when it tries to execute the sscanf() I get: > >[*] Debug: Reading data from file.. >[main] C:\DJGPP\PROGRAMS\MONEY.EXE 1000 (0) handle_exceptions: Exception: >STATUS >_ACCESS_VIOLATION >[main] MONEY 1000 (0) handle_exceptions: Dumping stack trace to >MONEY.EXE.core Right off, i would think that buf is shorter than 80 characters, so when you write to buf + 80, your writing over data that you havn't allocated... Just a thought... +++++++++ ++BlaizE++ +++++++++ +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/11/01 PDT