NAME

string - string utilities

SYNOPSIS

#include <basic/string.h>

struct string asgstr(s)
struct string *s;

dotrim(d, u, v)
struct string *d;
char *u, *v;

clrstr(d)
struct string *d;

int setstr(d, len)
struct string *d;
int len;

DESCRIPTION

These functions facilitate the creation and manipulation of strings.  D is a pointer to a destination string header.  The header must not contain a pointer to a string text buffer lest the buffer space be lost.  These functions are intended for the initialization of the given string.  The original contents of the header are ignored. 

Asgstr allocates and returns a copy of the string pointed to by s.  This function implements string assignment. 

Dotrim creates a string from the text between the locations pointed to by u and v, exclusive of v

Clrstr initializes the header to represent the null string.  The null string does not require a text buffer. 

Setstr initializes the header to represent a string with length len.  If len is non-zero, a text buffer is allocated with malloc(3) and attached to the header.  The contents of the buffer are undefined (but its length is guaranteed).  Zero is normally returned. 

These functions do not directly implement any BASIC functions.  These functions support other functions that require BASIC strings. 

SEE ALSO

string(inc)
malloc(3) in the UNIX Programmer’s Manual

DIAGNOSTICS

Setstr returns one if malloc(3) fails.  The header is not altered. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber