Passing CString as paramter

answerme's Avatar, Join Date: Dec 2007
Ambitious contributor
How to pass CString as a paramterey . I am passing CString as paramter in a particular function & on its defintion it should be convert into char array or char pointer.

Code:
void CexapmleDlg::OnBnClickedButton3() //INPUT BUTTON
{
	UpdateData(TRUE);
	Instring=(CString)InSpread;
	User_command(Instring);
}
void	User_command(char* command)
	{
		char	mess[MAX_MESSLEN];
		char	group[80];
		char	groups[10][MAX_GROUP_NAME];
		int		num_groups;
		unsigned int mess_len;
		int	ret;
		int	i;

		for( i=0; i < sizeof(command); i++ )
			command[i] = 0;
		/* if( fgets( command, 130, stdin ) == NULL ) 
			Bye();*/

		switch( command[0] )
		{
		case 'j':
			ret = sscanf( &command[2], "%s", group );
			if( ret < 1 ) 
			{
				a = CString(" invalid group \n");
				break;
			}
			ret = SP_join( Mbox, group );
			if( ret < 0 ) SP_error( ret );

			break;
}
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
So whats the problem?