void ChangeAddress()
{
char searchaddress;
char newaddress;
cout << endl;
cout << "Please enter street name to be changed ";
cin >> searchaddress;
for (int i=0; i<numrec; i++)
{
if (strcmp(SubscriberID[i].Subscriber_Address.streetname, searchaddress) == 0);
{
cout << "Enter the new street name: ";
cin >> newaddress;
}
}
}
error: invalid conversion from ‘char’ to ‘const char*’
error: initialising argument 2 of ‘int strcmp(const char*, const char*)'
I get this error wen using "strcmp(SubscriberID.Subscriber_Address.streetname, searchaddress) == 0);"
This function is part of a program which enters subrcribers into a file system. This specific function is supposed to edit the address of a subscriber. The subscribers are loaded to the array via input stream, and then the array is saved back to the text file. I can assume that there is no subscribers with any identical information.
searching the net hasnt given me much help, all i have found is that const char* is a pointer. All i want to do is compare the string in the array to the string entered by the user. Then if the string in array is equal to the one entered, i will then enter a new string to replace the one in the array. any ideas?