Basically I'm writing a function to change all the '|' characters in a string passed as a parameter to '\n' characters. Seems simple enough to do, but I get one of those "Application has encountered a problem and needs to close. We are sorry for the inconvenience." messages.
char * processString(char * s)
{
char * ret = s;
int a=0;
while (a < strlen(ret))
{
if (ret[a] == '|')
{
ret[a] = '\n';
}
a++;
}
return ret;
}
I've pinpointed thee error to the assignment statement:
ret[a] = '\n';
but I don't see what I'm doing wrong.
Thanks.