05-15-2008
According to POSIX.1-2001:
"The snprintf() function shall be equivalent to sprintf(), with the addition of the n argument which states the size of the buffer referred to by s. If n is zero, nothing shall be written and s may be a null pointer. Otherwise, output bytes beyond the n-1st shall be discarded instead of being written to the array, and a null byte is written at the end of the bytes actually written into the array."
7 More Discussions You Might Find Interesting
1. 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. Shell Programming and Scripting
I'm writing a script to archive data. First, the files are all rsync'd to the archive directory via NFS mounts(I know not the most efficient, but the only choice in this situation), then I use md5sum to validate the transfers. During execution of the script, it will exit for no apparent reason. It... (6 Replies)
Discussion started by: mph
6 Replies
3. Shell Programming and Scripting
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
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
5. Shell Programming and Scripting
Hi All,
is there a way or script that i can check my AIX 5.3 OS will restart before i made restart? is there a script that can check all the startup files are ok before restarting. it is because i was stuck last time when i restart my PC because some startup files were missing:o. (2 Replies)
Discussion started by: malcomex999
2 Replies
6. Shell Programming and Scripting
hi all,
i have a situation where i run ssh command from a unix machine to execute few scripts on 2 other unix machines.
my problem is, the scripts that i run will start few commands on the 2 servers and will quit....i am able to quit from the script but i have to give ctrl+c (on the... (10 Replies)
Discussion started by: niteesh_!7
10 Replies
7. AIX
http://ep.yimg.com/ay/iercomputer/ibm-39j5022-ultra320-scsi-adapter-dual-channel-pci-x-fc5736-3.gif
I have bought this controller.
Simple and fast question: I will put on this controller a external LTO tape,which is terminated with a terminator.
I have to put another terminator on PCI-controller... (1 Reply)
Discussion started by: Linusolaradm1
1 Replies
LEARN ABOUT X11R4
wprintf
WPRINTF(3) Linux Programmer's Manual WPRINTF(3)
NAME
wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - formatted wide-character output conversion
SYNOPSIS
#include <stdio.h>
#include <wchar.h>
int wprintf(const wchar_t *format, ...);
int fwprintf(FILE *stream, const wchar_t *format, ...);
int swprintf(wchar_t *wcs, size_t maxlen,
const wchar_t *format, ...);
int vwprintf(const wchar_t *format, va_list args);
int vfwprintf(FILE *stream, const wchar_t *format, va_list args);
int vswprintf(wchar_t *wcs, size_t maxlen,
const wchar_t *format, va_list args);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
All functions shown above:
_XOPEN_SOURCE >= 500 || _ISOC99_SOURCE ||
_POSIX_C_SOURCE >= 200112L
DESCRIPTION
The wprintf() family of functions is the wide-character equivalent of the printf(3) family of functions. It performs formatted output of
wide characters.
The wprintf() and vwprintf() functions perform wide-character output to stdout. stdout must not be byte oriented; see fwide(3) for more
information.
The fwprintf() and vfwprintf() functions perform wide-character output to stream. stream must not be byte oriented; see fwide(3) for more
information.
The swprintf() and vswprintf() functions perform wide-character output to an array of wide characters. The programmer must ensure that
there is room for at least maxlen wide characters at wcs.
These functions are like the printf(3), vprintf(3), fprintf(3), vfprintf(3), sprintf(3), vsprintf(3) functions except for the following
differences:
o The format string is a wide-character string.
o The output consists of wide characters, not bytes.
o swprintf() and vswprintf() take a maxlen argument, sprintf(3) and vsprintf(3) do not. (snprintf(3) and vsnprintf(3) take a maxlen
argument, but these functions do not return -1 upon buffer overflow on Linux.)
The treatment of the conversion characters c and s is different:
c If no l modifier is present, the int argument is converted to a wide character by a call to the btowc(3) function, and the resulting
wide character is written. If an l modifier is present, the wint_t (wide character) argument is written.
s If no l modifier is present: the const char * argument is expected to be a pointer to an array of character type (pointer to a
string) containing a multibyte character sequence beginning in the initial shift state. Characters from the array are converted to
wide characters (each by a call to the mbrtowc(3) function with a conversion state starting in the initial state before the first
byte). The resulting wide characters are written up to (but not including) the terminating null wide character (L'