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

NAME
firestring_snprintf - snprintf(3) provided as a replacement so programs can maintain ANSI C compliance SYNOPSIS
#include <firestring.h> -lfirestring long firestring_snprintf(char * out, const size_t size, const char * const format, ...) DESCRIPTION
firestring_snprintf() writes a maximum of size bytes to out based on the formatting rules specified in format and the further arguments provided. As snprintf(3) is not a ANSI C function, firestring_snprintf() is provided as a replacement for programs wishing to maintain ANSI C compli- ance. It acts much like snprintf(3), except that it only uses single-letter format tags, and only supports a subset of the common formats. Formats supported: %s - char * %d - int %l - long %u - unsigned int %y - unsigned long %g - signed long long %o - unsigned long long %f - double %t - time_t (printed in ISO format) %e - struct firestring_estr_t * The %s type handles NULL values by displaying the string "(null)". All numeric types support zero padding through the standard %02d for- mat. RETURN VALUE
Returns the number of bytes written to out not including the trailing nil. AUTHOR
Ian Gulliver <ian@penguinhosting.net> SEE ALSO
libfirestring(3) 2003-05-15 firestring_snprintf(3)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy