string to char ?


I'm trying to convert int to char* or char or whatever it is.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int main()
{    
    int m=50;
    char *a[m+1];
    int i;
    for(i=0;i<m;i++)
    {
         stringstream ss; 
         ss << rand()%2; 
         string go = ss.str();
         a[i]=&go[0];
         cout<<go<<endl;
         getchar();
         a[i]=(char)go; //ERROR HERE            
    }                       
}


Error Msg: `struct std::string' used where a `char' was expected

Can someone help me out here?
There is no assignment operator (=) with a char lhs and string rhs. You need to index the string character with either [] or at()
Topic archived. No new replies allowed.