//
//	Simple test program for fixed_string
//
//	J. Nagle
//	License: LGPL
//
#include "boost_fixed_string.hpp"
#include "boost_fixed_string_cstring.hpp"
using namespace boost;
#include <stdio.h>

static void printstring(const char_string_base& str)
{
	printf("Printing from a function: %s\n",str.c_str());
}

static void editstring(char_string_base& str,float val)
{	sprintf(str,"F = %f\n",val);	}

void boostfixedstringtest()
{
	//	String test
	char_string<80> s1;
	char_string<10> s2;
	s1.copy("This is a test");
	printf("Hello: %s\n",s1.c_str());
	sprintf(s1,"N=%d\n",100);
	s2.copy(s1);
	printf("Printing with printf directly: %s",s2.c_str());
	editstring(s2,100);	// This overflows the string.
	printstring(s2);
	printf("Iterator test: ");
	for (char_string_base::iterator p = s1.begin(); p != s1.end(); p++)
	{	putchar(*p);	}
	putchar('\n');
}
//
//	Main program
//
void main()
{	boostfixedstringtest(); }