C-style or function-style cast within a class method

This is my problem;
error C2664: 'isspace' : cannot convert parameter 1 from 'char *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.          

This is the section of code;
if(isspace(pSSNumber[i])){ // Determines it is a tab or space

Note: pSSNumber is char* class_name::pSSNumber.

This is the solution, maybe?;
if(isspace(int(pSSNumber[i]))){ // Determines it is a tab or space }

Note: the int() cast.

My question is; is there a better solution.  It turns out that I have to do a cast on many statements.  Seems to me that there should be a global solution.
chimaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JasonssCommented:
how about writing your own isspace() function that take char*
0
ExceterCommented:
char and int are synonymous terms. You will have no difficulty passing a char to isspace(). However, char* is a pointer to a char array, not a char. Your error leads me to beleive that pSSNumber is a multidimensional array. If so, this is your problem because a multi dimensional array is simply an array of pointers. Assuming that it is a two dimensional array you would check the first character in the array by saying,

if( isspace( pSSNumber[i][0] ) )

Could you post the section of code in which pSSNumber is declared?

Exceter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thienpnguyenCommented:
Are you sure, pSSNumber's type is char* .

I almost think, in your program pSSNumber's type is char** .

Could you check it .
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

ExceterCommented:
>> how about writing your own isspace() function that take char*

Because char* is a pointer not a char. char* variables are not used to store characters so writing a function that checked to see if its value was equivalent to a space character would be pointless.

Exceter
0
chimaAuthor Commented:
I believe that Exceter is right.  pSSNumber is a two demensional array. I had move this section of code from main(){} and did not think of the input statment for the array.  I will try Exceter's solution, then issue the points.  I'm new at this, therefore writing my own isspace would require more skill than what I have.

Sidebar: I did not get an email telling me that there were responses.  I wonder why?  Also, I saw that the status was/is <unlocked> what does this mean?  I read the links for "New EEs" but have not come accross its meaning.
I hope and I think that the question is still open.
0
ExceterCommented:
>> I did not get an email telling me that there were responses.  I wonder why?  

The email notifications get behind once in a while, the notification will show up.

>> Also, I saw that the status was/is <unlocked> what does this mean?

That simply means that you have not accepted an answer to this question yet.

Exceter
0
chimaAuthor Commented:
Exeter, you're smart and quick, thanks.
It worked.  Silly me for thinking that the problem was more difficult.  I have another question, which I will post tomorrow.  Once again thanks.
0
ExceterCommented:
You are most welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.