998
Appendix A: System Routines — Strings
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
strncpy
Declaration:
char *
strncpy
(char *
s1
, const char *
s2
, size_t
count
)
Category(ies):
Strings
Description:
Copies no more than
count
characters from the string pointed to by
s2
to
the character buffer pointed to by
s1
. The result will not be null terminated
if string
s2
is longer than
count
characters. If the objects pointed to by
s1
and
s2
overlap in memory, the behavior is undefined.
Inputs:
s1 —
Buffer to copy to.
s2
— Character string to copy from.
count
— Number of characters to copy.
Outputs:
Returns the value of
s1.
Assumptions:
s1
points to a buffer large enough to hold
count
characters.
Side Effects:
None
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: strcpy
,
memcpy
,
memmove
Example:
short CustomError( short errCode, const BYTE *msg)
/* Create custom error message. */
{
BYTE buf[260];
memset( buf, 0, sizeof(buf) );
strncpy( (char *) buf, (char *) msg, 128 );
strcat( (char *) buf, "\n" );
strncat( (char *) buf, (char *) find_error_message(errCode), 128 );
return( DlgMessage((const char *) XR_stringPtr(XR_ERROR),
(const char *) buf, PDB_OK, 0) );
}