Easy one first:
GC104 wrote:
Sprintf(BasicString, "ABCDDEF") : Bad because I haven't initialised it as soon as I declared it? or the fact that I'm using sprintf to load the string?
Bad because it wasn't char BasicString[100]; when I answered the question - it was (IIRC) char* BasicString :-) Also - sprintf is less than optimal for assigning a string to another string - strcpy is better, I guess.
GC104 wrote:
Any suggestions for an alternative to CW2A macro?
CW2A isn't a macro. It's a class. There are a few alternatives:
Make sure that pOutputString has storage associated with it and strcpy the CW2A into it:
char pOutputString\[1024\];
strcpy(pOutputString, CW2A(TxString));
Declare pOutputString to be of type CW2A and assign TXString to it. THat way the storage is associated with the lifetime of pOutputString, which is what you want:
CW2A pOutputString = TxString;
Declare pOutputString to be of some other ASCII string type and assign CW2A(TXString) to it. That way there is storage associated with the lifetime of pOutputString, which is what you want:
std::string pOutputString = CW2A(TxString);
I'd go for option 2, personally.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p