string - string utilities


#include <basic/string.h>

struct string asgstr(s)
struct string *s;

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

struct string *d;

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


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. 


malloc(3) in the UNIX Programmerís Manual


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

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber