Xref: utzoo comp.os.vms:39524 comp.lang.c:39894 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!mahendo!triton!robert From: robert@triton.jpl.nasa.gov (Robert Angelino) Newsgroups: comp.os.vms,comp.lang.c Subject: WHY is this crashing???!!! Message-ID: <6246@mahendo.Jpl.Nasa.Gov> Date: 6 Jun 91 23:43:10 GMT Sender: news@mahendo.Jpl.Nasa.Gov Reply-To: robert@triton.JPL.NASA.GOV Organization: Technology Development Group (JPL) Lines: 66 I have this code that keeps going out to lunch. Any suggestions are welcome. #ifdef vms char cur_time[26]; const char *ptr = (cur_time + 7); int status = 0, i = 0; $DESCRIPTOR(cur_time_desc,cur_time); #endif /* Extract the year from the time */ #ifdef vms if(((status = LIB$DATE_TIME(&cur_time_desc)) &1) != 1) return((jtm*)0); cur_time[11] = '\0'; #ifdef DEBUG printf("ptr = %s\n",ptr); #endif date->tm_year = atoi(ptr); #endif It CRASHES at the "atoi" call. This is the output I get from the run: %SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=00000014, PC=0000D8D9, PSL=03C00000 %TRACE-F-TRACEBACK, symbolic stack dump follows module name routine name line rel PC abs PC JTMSYSTEM jtm_system 2577 00000085 0000D8D9 TC_TASK tcr_sprintf 2375 00000028 0000AE00 TC_TASK write_rec 2476 0000014D 0000B059 ADCC update_adcc_data_table 1829 0000002F 0000754B USER_I user_interface_ml 4891 00000363 0000C403 SPA_TCLKUTC main 2642 000002A9 0000718D These are the logicals I'm using as the libraries: "LNK$LIBRARY" = "SYS$LIBRARY:VAXCCURSE" "LNK$LIBRARY_1" = "SYS$LIBRARY:VAXCRTL" I've tried the following and it still crashes: char *ptr = (char*) 0; . . . cur_time[11] = '\0'; ptr = cur_time + 7; date->tm_year = atoi((const char*) ptr); -- - ------ - Robert Angelino | | | ---- \ | | ms T-1704L | | | | \ | | | 4800 Oak Grove Drive | | | | -- | | | Pasadena, CA 91109 ---| | | | \__/ | |___ robert@triton.jpl.nasa.gov \____|et |_|ropulsion |_____\aboratory (818) 354-9574