js_str2js(3)

NAME
js_str2js - convert a standard character array in to a js_string object

SYNOPSIS
#include JsStr.h

int js_str2js(js_string *js, char *string, int count, int size);

DESCRIPTION
js_str2js converts the string pointed to by string in to a js_string object. The js_string object in question needs to have been previously created, and any string currently in the js_string object will be cloberred.

ARGUMENTS
js is a pointer to the js_string object we will place the converted character array in. string is the character array we are converting in to a js_string object. count is the length of the character array we are converting, measured in units. The size of a unit is one or more octets long, determined by size size is the number of octets a single unit of the js_string object is. This needs to agree with the internal value of unit length in the js_string object, otherwise the function will return an error and the string will not be converted. js_str2js returns JS_SUCCESS on successful conversion of the string, JS_ERROR otherwise.

EXAMPLE
The following example creates a js_string object that is given the string "What's up doc?"
	js_string *foo;
	foo = js_create(256,1);
	js_str2js(foo,"What's up doc?",14,1);

AUTHOR
Sam Trenholme <kiwi-zttfryb@koala.samiam.org>