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/ Microsoft® SQL Server™ 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 to start copying from. 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 legal 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  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.