M
Mark Hobley
I am trying to rewrite a section of code within an existing program.
This is a section of code (simplified and non-working) showing the structure
that I am trying to achieve:
char *ParseString (char *instring)
{
char *ptr1=instring
if (instring == NULL)
return instring;
while (*ptr1) {
switch(*ptr1) {
case iscntrl(*ptr1)
*ptr1=' ';
case isspace(*ptr1)
*ptr1=' ';
case '+'
*ptr1=' ';
case '%'
*ptr1=' ';
}
ptr1++;
}
}
I am trying to first use the iscntrl and isspace functions to evaluate *ptr1.
From this I will overwrite *ptr1 with a character. Then I want to compare *ptr1
to a series of known characters via a switch statement, and then do some
processing based upon that, changing *ptr1.
How is the best way to achieve this ?
Please advise.
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Telephone: (0121) 247 1596
International: 0044 121 247 1596
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/
This is a section of code (simplified and non-working) showing the structure
that I am trying to achieve:
char *ParseString (char *instring)
{
char *ptr1=instring
if (instring == NULL)
return instring;
while (*ptr1) {
switch(*ptr1) {
case iscntrl(*ptr1)
*ptr1=' ';
case isspace(*ptr1)
*ptr1=' ';
case '+'
*ptr1=' ';
case '%'
*ptr1=' ';
}
ptr1++;
}
}
I am trying to first use the iscntrl and isspace functions to evaluate *ptr1.
From this I will overwrite *ptr1 with a character. Then I want to compare *ptr1
to a series of known characters via a switch statement, and then do some
processing based upon that, changing *ptr1.
How is the best way to achieve this ?
Please advise.
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Telephone: (0121) 247 1596
International: 0044 121 247 1596
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/