Reading from file and displaying in edit box
Posted on 2004-11-05
Ok here's what I am trying to do:
I have a text file which has a row of readings for date, time, tempeature, rain, windspeed.
What I am doing is designing a GUI where a user can click a button and get latest temperature to appear in an edit box.(the latest reading is always in the same file).
For testing purposes i have a file just containg a number representing temperature and when I click the button the ascii value for the number in the file appears. Is there a function that will covert ascii to char or int?
Also my C++ programming skills are nothing special, I am just using fgetc to read from the file. If I want to have another button to say get curent rainfall or windspeed. How do I actualy navigate my way around the file. assuming its structured like:
date time tempeature rain windspeed
What is the difference in fgets and fgetc? is it simply to read a string (1 whole line ) and character( 1 digit)?
Would it be easier if i skipped a line between each reading instead of using tabs? Its in this format because its being dumped into a database and it is supposed to be in this form. i was hoping I could use the one file for dumping to database and viewing the latest rading from the GUI.
Thanks for any help.