Dbstrcpy()

From Recital Documentation Wiki
Jump to: navigation, search

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()