Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

snprintf(9) [suse man page]

SNPRINTF(9)						     Basic C Library Functions						       SNPRINTF(9)

NAME
snprintf - Format a string and place it in a buffer SYNOPSIS
int snprintf(char * buf, size_t size, const char * fmt, ...); ARGUMENTS
buf The buffer to place the result into size The size of the buffer, including the trailing null space fmt The format string to use @...: Arguments for the format string ... variable arguments DESCRIPTION
The return value is the number of characters which would be generated for the given input, excluding the trailing null, as per ISO C99. If the return is greater than or equal to size, the resulting string is truncated. See the vsnprintf documentation for format string extensions over C99. COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 SNPRINTF(9)

Check Out this Related Man Page

SNPRINTF(3P)						     POSIX Programmer's Manual						      SNPRINTF(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
snprintf -- print formatted output SYNOPSIS
#include <stdio.h> int snprintf(char *restrict s, size_t n, const char *restrict format, ...); DESCRIPTION
Refer to fprintf(). COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 SNPRINTF(3P)
Man Page

4 More Discussions You Might Find Interesting

1. Solaris

problem with sprintf snprintf in Solaris

******************************** Following is not the real issue. The issue is with popen. Plz continue forward with the thread to get a better picture. ******************************** Hi, I am working on a customised ftp application. In it we have used sprintf to store a UNIX command... (7 Replies)
Discussion started by: diganta
7 Replies

2. Programming

does snprintf guarantee null termination?

Hi All, I was reading the man page of snprintf function and it saids that snprintf adds a null terminator at the end of the string, but I remember once someone told me that snprintf doesn't guarantee the insertion of a null terminator character. What do you think? Does anyone have experience... (4 Replies)
Discussion started by: lagigliaivan
4 Replies

3. Shell Programming and Scripting

Perl script to search sprintf and replace with snprintf

Dear all, I am new to perl script and would need some help for my 1st script. I wrote a script to search sprintf(buf,"%s", sourcestring) and replace with snprintf(buf, sizeof(buf),"%s", sourcestring). As snprintf() requires an extra argument, so it is not a simple search-and-replace. I need to... (1 Reply)
Discussion started by: ChaMeN
1 Replies

4. Shell Programming and Scripting

search sprintf and replace with snprintf

Hi, anyone knows the perl search-and-replace expression for strcpy (char * destination, const char * source ); to strncpy ( char * destination, const char * source, size_t num ); ? the first and second arguments are the same (destination and source), the difference being that strncpy... (1 Reply)
Discussion started by: ChaMeN
1 Replies