Newsgroups: comp.lang.c Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!mouse From: mouse@thunder.mcrcim.mcgill.edu (der Mouse) Subject: Re: Does anyone know why this is crashing?? Message-ID: <1991Jun6.144910.789@thunder.mcrcim.mcgill.edu> Organization: McGill Research Centre for Intelligent Machines References: <6240@mahendo.Jpl.Nasa.Gov> Date: Thu, 6 Jun 91 14:49:10 GMT Lines: 31 In article <6240@mahendo.Jpl.Nasa.Gov>, robert@triton.jpl.nasa.gov (Robert Angelino) writes: > I have this bit of code that works perfectly on a SPARC and crashes > on a VMS (O/S- V5.3-A) system?! > #define EOPEN "Unable to open %s file \"%s\"\n" > (void) print_msg(PERROR,"init_files()", > sprintf(buf,EOPEN,"startup",startup_file)); > It's crashing when it hits the sprintf call in init_files(). Are you sure? I suspect it's crashing inside print_msg. sprintf() returns the resulting string on some, but not all, systems. Not having access to a VMS machine to try this out on, I suspect sprintf() there is returning something else - zero, or the number of characters written, or some such. Try instead sprintf(buf,EOPEN,"startup",startup_file); (void) print_msg(PERROR,"init_files()",buf); which should work everywhere. If that doesn't fix it I have no more ideas and would have to plunge in with a debugger. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu