Does anyone know why this is crashing??
Boyd Roberts
boyd at prl.dec.com
Fri Jun 7 01:38:23 AEST 1991
In article <6240 at mahendo.Jpl.Nasa.Gov>, robert at 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 at prl.dec.com
``When the going gets wierd, the weird turn pro...''
More information about the Comp.lang.c
mailing list