GRASS GIS 7 Programmer's Manual  7.0.2(2015)-r00000
snprintf.c
Go to the documentation of this file.
1 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <stdarg.h>
26 #include <unistd.h>
27 #include <assert.h>
28 #include <grass/gis.h>
29 
43 int G_snprintf(char *str, size_t size, const char *fmt, ...)
44 {
45  va_list ap;
46  int count;
47 
48  va_start(ap, fmt);
49  count = vsnprintf(str, size, fmt, ap);
50  va_end(ap);
51 
52  /* Windows' vsnprintf() doesn't always NUL-terminate the buffer */
53  if (count == size)
54  str[--count] = '\0';
55 
56  return count;
57 }
int count
int G_snprintf(char *str, size_t size, const char *fmt,...)
snprintf() clone.
Definition: snprintf.c:43