Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!decprl!decprl!boyd From: boyd@prl.dec.com (Boyd Roberts) Newsgroups: comp.lang.c Subject: Re: Does anyone know why this is crashing?? Message-ID: <1991Jun6.153823.11614@prl.dec.com> Date: 6 Jun 91 15:38:23 GMT References: <6240@mahendo.Jpl.Nasa.Gov> Sender: news@prl.dec.com (USENET News System) Reply-To: boyd@prl.dec.com (Boyd Roberts) Organization: Digital Equipment Corporation - Paris Research Laboratory Lines: 21 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)); > Sounds like you've forgotten that sprintf(3) returns `char *' on some systems and `int' on others. What's the bet that the VMS sprintf(3) returns `int'? Never use sprintf(3)'s return value. Don't even think about #ifdef'ing for the two types. Bite the bullet, and code around it. Boyd Roberts boyd@prl.dec.com ``When the going gets wierd, the weird turn pro...''