strcat

From: David Rogers (davidr655_at_yahoo.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 20:52:06 GMT


        I am trying to write a program which takes a string array and
after removing any non alphabet characters, writes the remaining
characters to another string array.
        I wrote the following code:

// Program to use the isalpha function

#include <iostream.h>
#include <ctype.h>
#include <string.h>

int main()
{
        char MyString[10] = "W2in5dows";
        char NewWord[10];
        for(int count = 0; count < strlen(MyString); count++)
                if (isalpha(MyString[count]))
                       strcat(NewWord, MyString[count]);
        cout << NewWord << endl;
}

        When I compile I get the error message that the second
argument to the strcat function "lacks a cast" . I can't figure out
how to cure this.

        Thanks