Please support our C++ advertiser: Programming Forums
Views: 2583 | Replies: 2 | Solved
•
•
Join Date: Jan 2005
Posts: 31
Reputation:
Rep Power: 4
Solved Threads: 0
Does anyone know how to compare a old style character string with a character in qoutes? Example:
I want to compare the first character in a record that is stored in an old style character string with a "*". Here's what I have in my code:
char FirstCharacter[1]; // Character string to hold to value found by
the peek() function
OutputFile.seekp(Total * 60);
//Seek to the correct position
FirstCharacter[0] = OutputFile.peek();
//FirstCharacter set equal to peek()
if (FirstCharacter[0] == "*")
{
cout << "Dummy Record";
}
//Try to compare value stored in FirstCharacter with a "*". If it is true, I know that I can write my record there.
It will not compare the string like it is. I get the error "Cannot convert char to char*". I tried strcmp() also, but to no avail. I get the error message "Cannot find a match for strcmp(char, char*). Anyone have any suggestions? Thanks a lot.
I want to compare the first character in a record that is stored in an old style character string with a "*". Here's what I have in my code:
char FirstCharacter[1]; // Character string to hold to value found by
the peek() function
OutputFile.seekp(Total * 60);
//Seek to the correct position
FirstCharacter[0] = OutputFile.peek();
//FirstCharacter set equal to peek()
if (FirstCharacter[0] == "*")
{
cout << "Dummy Record";
}
//Try to compare value stored in FirstCharacter with a "*". If it is true, I know that I can write my record there.
It will not compare the string like it is. I get the error "Cannot convert char to char*". I tried strcmp() also, but to no avail. I get the error message "Cannot find a match for strcmp(char, char*). Anyone have any suggestions? Thanks a lot.
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Threaded Mode