Guest_imported
New member
- Jan 1, 1970
- 0
Can some tell me what i can use to read a text document and convert all occurance of ";" to "/".
I can read the file using fscanf() fgetc but cannot convert ";".
Text file has years and events as below.
1966 England won world cup; dgfgsgggd.
2002 New world cup game; all invited.
to read this i am using the command
int year;
char event [300];
year = fscanf (fp,"%f%",&year);
fgets(event,300,fp);
tried!
if (event = ';'){
event = '/';
else event = event; }
did not work, what i must do is to read character by character and do covert if ';' found to '/'.
I tried doing so with other command but no luck.
please help!!
I can read the file using fscanf() fgetc but cannot convert ";".
Text file has years and events as below.
1966 England won world cup; dgfgsgggd.
2002 New world cup game; all invited.
to read this i am using the command
int year;
char event [300];
year = fscanf (fp,"%f%",&year);
fgets(event,300,fp);
tried!
if (event = ';'){
event = '/';
else event = event; }
did not work, what i must do is to read character by character and do covert if ';' found to '/'.
I tried doing so with other command but no luck.
please help!!