;Ask a string and reserve memory for a string. Add another string to the string.
;Print the new string

		include	"baselibs.i"
		include	"baselibs1.i"
		include	"string.i"


	#define	LF,10
	#define	OLD_MODE,1005

		variables

		CPTR	_string			;address of string
		CPTR	_letter			;address of letter
		CPTR	_memstring
		array	char,string,40
		array	char,letter,40

	main()

	int	size
	BPTR	conhandle
	{
	func	conhandle,=,fopen,<"CON:0/0/640/100/CLI_WINDOW">,OLD_MODE
		if	conhandle,==,0,c1
			{
			print	<"no open CON:">
			exit	0
			}
			ifend	c1
		calc	_stdout,=,conhandle
		
		pointer	_string,=&,string	;address to pointer
		pointer	_letter,=&,letter

		print	<"give a string",LF>
		func	size,=,gets,_string		;don't give more than 39 characters
			if	size,!=,0,1		;don't if zero
			{
				func	_memstring,=,allocmem,80,1		;get memory
				if	_memstring,!=,0,2
				{
					strcpy	_memstring,_string		;copy string to memory
					strcpy	_letter,_memstring
					strcat	_memstring,_string	;add string to memstring
					print	<"",LF>
					printf	<"moved a file %s size %ld",LF>,_memstring,size
					strupr	_letter		;chance to upper case
					print	_letter
					strlwr	_letter		;chance to lower case
					print	<"",LF>
					print	_letter		
				}
				ifend	2

				freemem	_memstring,40

			}
			ifend	1

		print	_string
		print	<"",LF>
		printf	<"move a string %s size %ld",LF>,_letter,size		;print a string from memory		

	getchar()
	fclose	conhandle
	}
	
	end

