- #1
James889
- 192
- 1
Hi,
I'm trying to write a simple program that reads the content of a textfile and removes all hyphen by replacing them with ' '
Any ideas?
I'm trying to write a simple program that reads the content of a textfile and removes all hyphen by replacing them with ' '
Code:
#include <stdio.h>
#include <stdlib.h>
int main(){
FILE *fp = fopen("Thetextfile.txt","r+") /* Open for reading and writing */
char ch;
while(ch = fgetc(fp) != EOF){
if(ch == '-')
fputc(' ',fp) /*This does not work */
}
return 0;
}
Any ideas?