S
silverburgh.meryl
Hi,
how can I literator a const char*?
I have this code, but it results in an infinite loop. It never exits
the while (p1 != '\0') loop
void teststr( const char *str1) {
char* p1 = (char*)str1;
while (p1 != '\0') {
//....
p1 ++;
}
}
and i call teststr like this:
teststr("http://www.cnn.com");
Can you please tell me why i never exit the while loop?
Thank you.
how can I literator a const char*?
I have this code, but it results in an infinite loop. It never exits
the while (p1 != '\0') loop
void teststr( const char *str1) {
char* p1 = (char*)str1;
while (p1 != '\0') {
//....
p1 ++;
}
}
and i call teststr like this:
teststr("http://www.cnn.com");
Can you please tell me why i never exit the while loop?
Thank you.