1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Passing CString as paramter

Discussion in 'MFC' started by answerme, Aug 31, 2009.

  1. answerme

    answerme New Member

    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;
    }
     
  2. shabbir

    shabbir Administrator Staff Member

    So whats the problem?
     

Share This Page