Difference between revisions of "Dbstrcpy()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
Line 11: Line 11:
  
 
<input parameters>
 
<input parameters>
char adjmode; /* Adjustment mode: 'r' or 'R' for right adjusted 'l' or 'L' for left adjusted */
+
char adjmode; /* Adjustment mode: 'r' or 'R' for right adjusted 'l' or 'L' for left adjusted */
int length; /* Length of formatted string */
+
int length; /* Length of formatted string */
char *origstr; /* Original string to be formatted */
+
char *origstr; /* Original string to be formatted */
  
 
<output parameter>
 
<output parameter>
char *string; /* Address of a buffer where the formatted string is placed by the function */
+
char *string; /* Address of a buffer where the formatted string is placed by the function */
  
 
</code>
 
</code>
Line 32: Line 32:
  
 
NOTE:  The formatted string is not NULL terminating!
 
NOTE:  The formatted string is not NULL terminating!
 +
  
 
==EXAMPLE==
 
==EXAMPLE==

Latest revision as of 15:33, 1 May 2009

PURPOSE

format string for fields and keys


SYNOPSIS

#include "dbl.h"
 
	int	dbstrcpy(string, adjmode, length, origstr)
 
	<input parameters>
	char	adjmode;	/* Adjustment mode: 'r' or 'R' for right adjusted 'l' or 'L' for left adjusted */
	int	length;	/* Length of formatted string */
	char	*origstr;	/* Original string to be formatted */
 
	<output parameter>
	char	*string;	/* Address of a buffer where the formatted string is placed by the function */


RETURN VALUE

This function has no return values.


DESCRIPTION

This function formats a string according to the specified adjustment mode and length of string. If the "adjmode" input parameter is either 'R' or 'r', the resulting string is right adjusted, if it is either 'L' or 'l', the resulting string is left adjusted. Make sure to allocate the character array "string" of at least size "length" to avoid character string overflow.

NOTE: The formatted string is not NULL terminating!


EXAMPLE

This example formats a string "John Smith" to a left adjusted 10 character long string.

#include "dbl.h"
 
	char	string[10];
 
	dbstrcpy(string, 'L', 10, "John Smith");


SEE ALSO

dbatofld(), dbatokey(), dbstring()