Difference between revisions of "Dbstring()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 12: | Line 12: | ||
<input parameters> | <input parameters> | ||
− | char *charbuf; /* Address of a buffer containing string to be formatted | + | char *charbuf; /* Address of a buffer containing string to be formatted */ |
− | int length; /* Length of formatted string | + | int length; /* Length of formatted string */ |
<output parameter> | <output parameter> | ||
− | char *Cstringbuf; /* Address of a buffer where the formatted string is placed by the function */ | + | char *Cstringbuf; /* Address of a buffer where the formatted string is placed by the function */ |
</code> | </code> | ||
Line 39: | Line 39: | ||
#include "dbl.h" | #include "dbl.h" | ||
− | char string[]; | + | char string[]; /* String buffer */ |
dbstring("John Smith", 10, string); | dbstring("John Smith", 10, string); |
Latest revision as of 15:34, 1 May 2009
PURPOSE
format character string into a 'C' string
SYNOPSIS
#include "dbl.h" int dbstring(charbuf, length, Cstringbuf) <input parameters> char *charbuf; /* Address of a buffer containing string to be formatted */ int length; /* Length of formatted string */ <output parameter> char *Cstringbuf; /* 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 in 'charbuf' of length 'length' into a 'C' null terminated string. This function is only of use to 3GL programs written in languages other than 'C' which do not support null terminated strings.
EXAMPLE
This first example formats the string "John Smith".
#include "dbl.h" char string[]; /* String buffer */ dbstring("John Smith", 10, string);
The second, VMS/COBOL, example formats a string using dbstring() before calling The dbopen() function.
INDENTIFICATION DIVISION. PROGRAM – ID. COBOL_OPEN. . . . 01 DATABASE_NAME PIC X(13). 01 DBF_FD PIC 9(09) COMP. 01 RETURN_STAT PIC S9(04). . . . START-01 CALL-DBOPEN. CALL "dbstring" USING BY VALUE "DATABASE.DBF" 13 REFERENCE DATABASE NAME. CALL "dbopen" USING BY CONTENT DATABASE_NAME REFERENCE DBF_FD GIVING RETURN_STAT . . .