Need help with reading text files
Need help with reading text files
(OP)
hello,
basicly my problem is how to read text file that contains chars and real numbers witch i need to modify, and not to change any other char in it;
i have to make a procedure that changes degrees that are shown in F and convert them in C;
input file should look like this:
"today's the temperature should be 15C and tomorrow 56.2F"
and the output file like this:
"today's the temperature should be 15C and tomorrow 13.44C"
something like that
plz help me
basicly my problem is how to read text file that contains chars and real numbers witch i need to modify, and not to change any other char in it;
i have to make a procedure that changes degrees that are shown in F and convert them in C;
input file should look like this:
"today's the temperature should be 15C and tomorrow 56.2F"
and the output file like this:
"today's the temperature should be 15C and tomorrow 13.44C"
something like that
plz help me
RE: Need help with reading text files
The simplest way to do it would be to create a loop that reads each line of the file, searches and replaces the text of interest (your numbers), and writes the modified line to a new file. After doing this for all lines in the file, delete the original file and rename the new file to the original file's name.
Good luck.