whats wrong witt this?
-
ok... my problem accures in this line of code: strcpy(M_ID, STID); error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' M_ID is a member of my class ID, and STID is a char created within the function that this code lies. i dont understand why it says char to * char because, non of them are pointers. thanks for your help! ~SilverShalkin
-
ok... my problem accures in this line of code: strcpy(M_ID, STID); error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' M_ID is a member of my class ID, and STID is a char created within the function that this code lies. i dont understand why it says char to * char because, non of them are pointers. thanks for your help! ~SilverShalkin
strcpy requires char* as arguements to the function. So if STID is a plain char, the compiler will attempt to convert the char to a char* to fit into the arguement in strcpy. Since there is no conversion for the compiler to do this, it reports and error. You will need to use a char*.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
strcpy requires char* as arguements to the function. So if STID is a plain char, the compiler will attempt to convert the char to a char* to fit into the arguement in strcpy. Since there is no conversion for the compiler to do this, it reports and error. You will need to use a char*.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!ok... so i would have to have a pointer on the second one like: strcpy(M_ID, *PID); *PID points to SID which is the intake of info for the function. or would i do... strcpy(M_ID, PID); //without derefrencing it? Thanks! ~SilverShalkin :rose:
-
ok... so i would have to have a pointer on the second one like: strcpy(M_ID, *PID); *PID points to SID which is the intake of info for the function. or would i do... strcpy(M_ID, PID); //without derefrencing it? Thanks! ~SilverShalkin :rose:
You do not want to dereference it. But once again, PID must be a char*.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
You do not want to dereference it. But once again, PID must be a char*.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!i changed it to what you said, and now i got this error pop up: error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' what does it mean by parameter 1? thanks! ~SilverShalkin :rose:
-
i changed it to what you said, and now i got this error pop up: error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' what does it mean by parameter 1? thanks! ~SilverShalkin :rose:
well, i looked up some of my errors in msdn and it said that the main problem of the code is that the person is trying to set two seperate things equal to each other, like-a pointer and a non pointer, or a intiger and a character. one of the main problems as i was going through out figuering this out was... my header file held different info than my cpp, so it made a bunch on errors.... I think i got it, to the point that i wont come across the problem again, unless its a typo "which, as a experienced programmer know (theres always typos :) )" Thanks for your help! ~SilverShalkin :rose: