Sponsored Content
Top Forums Programming does snprintf guarantee null termination? Post 302196001 by shamrock on Friday 16th of May 2008 11:40:11 AM
Old 05-16-2008
I would rely on the manpage of snprintf() on your system instead of on a certain someone. You can write a small code snippet to verify if snprintf() provides that functionality.
 

7 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. Shell Programming and Scripting

random script termination

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

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

5. Shell Programming and Scripting

guarantee to start before restart...

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

Problem with ssh termination...

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

A question about scsi termination

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
explain_snprintf_or_die(3)				     Library Functions Manual					explain_snprintf_or_die(3)

NAME
explain_snprintf_or_die - formatted output conversion and report errors SYNOPSIS
#include <libexplain/snprintf.h> int explain_snprintf_or_die(char *data, size_t data_size, const char *format); int explain_snprintf_on_error(char *data, size_t data_size, const char *format); DESCRIPTION
The explain_snprintf_or_die function is used to call the snprintf(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_snprintf(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_snprintf_on_error function is used to call the snprintf(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_snprintf(3) function, but still returns to the caller. data The data, exactly as to be passed to the snprintf(3) system call. data_size The data_size, exactly as to be passed to the snprintf(3) system call. format The format, exactly as to be passed to the snprintf(3) system call. RETURN VALUE
The explain_snprintf_or_die function only returns on success, see snprintf(3) for more information. On failure, prints an explanation and exits, it does not return. The explain_snprintf_on_error function always returns the value return by the wrapped snprintf(3) system call. EXAMPLE
The explain_snprintf_or_die function is intended to be used in a fashion similar to the following example: int result = explain_snprintf_or_die(data, data_size, format); SEE ALSO
snprintf(3) formatted output conversion explain_snprintf(3) explain snprintf(3) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2010 Peter Miller explain_snprintf_or_die(3)
All times are GMT -4. The time now is 07:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy