Does anyone know why this is crashing??

der Mouse mouse at thunder.mcrcim.mcgill.edu
Fri Jun 7 00:49:10 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));

> 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 at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list