[comp.sys.mac.hypercard] Array of characters in a XFCN

pff@beach.cis.ufl.edu (Pablo Fernicola) (10/04/89)

To use a string constant within a XFCN, using THINK C, one has to use
RememberA0() and SetUpA4().

Well, now I am trying to use an array of string constants, but when I address
the elements of the array I get junk.  It sounds a lot like the problem
I had with the string constants before using RemmeberA0 and SetUpA4.

I am using THINK C 4.

-----------------------------------------------------------------------------

#include	<MacTypes.h>
#include	"HyperXCmd.h"
#include	<SetUpA4.h>
#include	<MacTypes.h>


char	entries[2][2][3] = {"11", "12", "21", "22"};

pascal void	main(paramPtr)
XCmdBlockPtr paramPtr;
{
char	*header = "hello", temp[6];

RememberA0();
SetUpA4();

/*
If I use the string "header" it works !!!

strcpy(temp, header);
*/

strcpy(temp, (char *) entries[0][0]);

paramPtr->returnValue = NewHandle( (long) strlen(temp) + 1);
strcpy( (char *) *paramPtr->returnValue, temp);
		
return;
}

--
pff@beach.cis.ufl.edu  Pablo Fernicola - Machine Intelligence Laboratory - UF
"If we knew how it works, it wouldn't be called research."  -, _/:
							    \ o.O ,
							    =(___)=