how to find and replace string

hi
I wanted to find this char " ^M " in my file and replace it with blank space.
I am using Unix system.
If i give command " :%s/^M//gc " it wont work
so can anyone tell what is command to find and replace

thankx

You have posted in the "C Programming..." forum. But seeing your command it is actually a non C programming question.

Run dos2unix on the file before you view it i.e. dos2unix input.txt

i suppose the ^M character issued in replace mode is done by typing ctrl-v + ctrl-m -- then it would work definitely.

cat file | tr "\r" " " >outfile

in C <pseudocode>:
fd=open()
loop:
read(fd,buf,1)
if (buf== ^M) buf =' '
write(fileno_stdout,buf,1);
clsoe(fd);