wxSnprintf() and wxVsnprintf() added, documented and used in wxLog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-15 15:49:59 +00:00
parent e2de943347
commit 378b05f7f8
6 changed files with 160 additions and 64 deletions

View File

@@ -412,6 +412,33 @@ should help to find the strings which were not yet translated. As this function
is used very often, an alternative syntax is provided: the \_() macro is
defined as wxGetTranslation().
\membersection{::wxSnprintf}\label{wxsnprintf}
\func{int}{wxSnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{}{...}}
This function replaces the dangerous standard function {\tt sprintf()} and is
like {\tt snprintf()} available on some platforms. The only difference with
sprintf() is that an additional argument - buffer size - is taken and the
buffer is never overflowed.
Returns the number of characters copied to the buffer or -1 if there is not
enough space.
\wxheading{See also:}
\helpref{wxVsnprintf}{wxvsnprintf},
\helpref{wxString::Printf}{wxstringprintf}
\membersection{::wxVsnprintf}\label{wxsnprintf}
\func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argptr}}
The same as \helpref{wxSnprintf}{wxsnprintf} but takes a {\tt va\_list}
argument instead of arbitrary number of parameters.
\wxheading{See also:}
\helpref{wxSnprintf}{wxsnprintf},
\helpref{wxString::PrintfV}{wxstringprintfv}
\section{Dialog functions}\label{dialogfunctions}
Below are a number of convenience functions for getting input from the

View File

@@ -144,6 +144,13 @@ and returns 0 for them and \helpref{Stricmp()}{Stricmp} is just a
platform-independent version of case-insensitive string comparison function
known either as stricmp() or strcasecmp() on different platforms.
The {\tt <wx/string.h>} header also defines \helpref{wxSnprintf}{wxsnprintf}
and \helpref{wxVsnprintf}{wxvsnprintf} functions which should be used instead
of the inherently dangerous standard {\tt sprintf()} and which use {\tt
snprintf()} instead which does buffer size checks whenever possible. Of
course, you may also use \helpref{wxString::Printf}{wxstringprintf} which is
also safe.
There is another class which might be useful when working with wxString:
\helpref{wxStringTokenizer}{wxstringtokenizer}. It is helpful when a string must
be broken into tokens and replaces the standard C library {\it