I've been browsing the boards for sometime, so I've decided to post.
I found - somewhat of an answer, although I'm still having problems.
Simply put - I'm trying to convert the string to upper case. The first letter in each word to be exact.
ex: "this is my special string"
converted to: "This Is My Special String"
I've been trying to work with strcmp( ), but to no avail...
-----
I started off by using:
Code:
char myChar[] = "this is my test string";
for (i = 0; i < sizeof(myChar); i++)
{
// find space, next character change into uppercase
if ( !strcmp(myChar[i], " ") )
{
myChar[i+1] = toupper(myChar[i+1]);
}
}
-----
From there I received error C2664: 'strcmp' : cannot convert parameter 1 from 'const char' to 'const char *'
So I tried..
------
Code:
const char *myChar = "this is my test string"; // removed [], due to error
for (i = 0; i < sizeof(myChar); i++)
{
// find space, next character change into uppercase
if ( !strcmp(myChar[i], " ") )
{
myChar[i+1] = toupper(myChar[i+1]);
}
}
------
This still gives me the same error! I can't seem to figure out why... I've been working on it for a couple of hours too!
Any insight would be appreciated :)