dbstrcpy

DB Library for C

DB Library for C

dbstrcpy

Copies a portion of the command buffer in the DBPROCESS structure to a specified memory location.

Syntax

RETCODE dbstrcpy (
PDBPROCESS
dbproc,
INT
start,
INT
numbytes,
LPSTR
dest );

Arguments

dbproc

Is the DBPROCESS structure that is the handle for a particular workstation or Microsoft® SQL Server™ 2000 process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.

start

Is the character position in the command buffer from which to start copying. The first character position is 0. If start is greater than the length of the command buffer, a null terminator is inserted at dest[0].

numbytes

Is the number of characters to copy.

numbytes setting Result
< 0 dbstrcpy copies the entire command buffer. It is valid to copy 0 bytes.
= 0 A null terminator is inserted at dest[0].
> 0 dbstrcpy copies the number of bytes available and returns SUCCEED.

dest

Is a pointer to the memory location to copy the source string into.

Returns

SUCCEED or FAIL. FAIL is returned if start is a negative number.

Remarks

The copy is null-terminated. The dbstrcpy function assumes that the destination string is large enough to receive the source string. If not, unexpected errors may occur.

Internally, the command buffer is a linked list of nonterminated text strings. Parts of the command buffer can be located and copied using the dbgetchar, dbstrcpy, and dbstrlen functions.

See Also

dbcmd

dbgetchar

dbfcmd

dbstrlen

dbfreebuf