/home5/piconepr/public_html/isip/projects/speech/software/documentation/class/system/SysString/sstr_03.cc
// file: $isip/class/system/SysString/sstr_03.cc
// version: $Id: sstr_03.cc 10564 2006-04-22 03:06:55Z may $
//
// system include files
// note that we need some basic string functions. these are not included
// in Integral.h since users are not expected to use these functions.
//
#include <strings.h>
[snipped]
// isip include files
//
#include "SysString.h"
#include <Console.h>
[snipped]
// method: assign
//
// arguments:
// ulong arg: (input) number to convert
// const unichar* fmt: (input) print format
//
// return: a boolean value indicating status
//
// convert an unsigned long integer into a string
//
boolean SysString::assign(ulong arg_a, const unichar* fmt_a) {
// allocate a static buffer for printing
//
static char buf[MAX_LENGTH];
static char fmt[MAX_LENGTH];
static char* fmt_ptr;
// check the arguments
//
if (fmt_a == (unichar*)NULL) {
return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__);
}
SysString temp(fmt_a);
temp.getBuffer((byte*)fmt, MAX_LENGTH);
fmt_ptr = fmt;
// clear out the current value
//
clear(Integral::RESET);
// create and possibly assign the string
//
if (sprintf(buf, fmt_ptr, arg_a) > 0) {
assign((byte*)buf);
return true;
}
// exit gracefully
//
return false;
}
[snipped]
//
// end of file
Up |
Home |
Courses |
Projects |
Proposals |
Publications
Please direct questions or comments to
joseph.picone@isip.piconepress.com