strcat
From: David Rogers (davidr655_at_yahoo.com)
Date: 12/30/04
- Next message: Mike Wahler: "Re: strcat"
- Previous message: Rich: "Re: reinterpret_cast"
- Next in thread: Mike Wahler: "Re: strcat"
- Reply: Mike Wahler: "Re: strcat"
- Reply: Ulrich Eckhardt: "Re: strcat"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Mike Wahler: "Re: strcat"
- Previous message: Rich: "Re: reinterpret_cast"
- Next in thread: Mike Wahler: "Re: strcat"
- Reply: Mike Wahler: "Re: strcat"
- Reply: Ulrich Eckhardt: "Re: strcat"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]