954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Character Array to character pointer.

Greetings
I've been faced with this problem may be you could help?

<strong>class</strong> CalculatorObject : <strong>public</strong> TDialog 
{
	<strong>public:</strong>
		StateType CurrentMode;	
		<strong>char</strong> Operator;							

		<strong>char</strong> DisplayBuffer[DisplayPlusSign];   
		
		<strong>BOOL</strong> Negative;							
		<strong>BOOL</strong> InputIsADigit(<strong>char</strong>* input);       
		<strong>double</strong> Operand;							
		TBrush CalcBackground;	.....


I need to change char DisplayBuffer into a character pointer instead of a character array.

Many Thanx

Vagabond
Newbie Poster
8 posts since Mar 2006
Reputation Points: 34
Solved Threads: 0
 

have you tried this? I guess you already know that you will have to allocate memory for that buffer before using it -- yes??

char*  DisplayBuffer;
Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Yeh! thanx. I need to change the definition of DisplayBuffer to allow values to be assigned to it.

Vagabond
Newbie Poster
8 posts since Mar 2006
Reputation Points: 34
Solved Threads: 0
 

>>I need to change the definition of DisplayBuffer to allow values to be assigned to it.

you don't have to make it a pointer as I posted, just copy whatever string you want into it.

char DisplayBuffer[255];

strcpy(DisplayBuffer,"Hello World");
Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You