How to convert from char * to enum
-
Dear All, I have a file from which i am reading a value.The file contents are like : ProtocolType = E1_EURO_ISDN and i am trying to take " E1_EURO_ISDN" into a string variable, protocoltype. int x=0; char *line; fgets(line,100,stream); :::::::::::: :::::::::::: :::::::::::: Assumed that the string is taken into buffer.
if(strstr(line,"ProtocolType")) { // go to end of line for( i=strlen(line)-1,l=0;line[i]!=' ';i--,l++) { protocoltype[l]=line[i]; } protocoltype[i]='\0'; strcpy(protocoltype,strrev(protocoltype));
BoardParam->TrunkConfig[x].ProtocolType=protocoltype; }//end ifBut it gives error like "cannot convert from 'char *' to 'enum PSTNProtocolType'"
How do I solve the problem as protocoltype have to have a char string. Thanks in advance. amit mishra