NAME

kjb_sprintf - A version of sprintf that checks for buffer overflow and has some extras

SYNOPSIS

#include "l/l_sys_str.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 


long kjb_sprintf
(
	char *buff,
	size_t max_len,
	const char *format_str,
	...
);

DESCRIPTION

This routine is similar to sprintf(), except that it checks for buffer overflow. The extra formatting items described in kjb_fprintf() are available. Thus is it is more similar to snprinf(), but that routine is not universally available (at least at the time this routine was written). We don't have a separate routine for when we want buffer overflow to be checked because it should always be checked.

RETURNS

If successful, this returns the length of the printed string (not including the null terminator character), just like sprintf. This returns ERROR if a problem is encountered.

WARNING

The second parameter of this routine is the size of the buffer. This is DIFFERENT than sprintf!

RELATED

kjb_fprintf

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Kobus Barnard

DOCUMENTER

Kobus Barnard

SEE ALSO

kjb_vsprintf