By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Weather Prediction Program Help

P: n/a
To all who know C++,

Im working on a prog that will be able to predict the weather, its too
complicated to go into here, but I do need some help.

I need to grab all of the information in the file currdat.lst that is in
quotes and store them in variables. Sounds simple enough, right? This area
of my prog. is complete garbage, so I wont bother to post it.

For anyone interested in helping, the next line is line one of
currdat.lst
[header]
programm_name = "heavy weather"
programm_version = "Ver. 2.0 beta release"
file_name = "currdat.lst"
file_format_version = "ver. 1.0"

[time]
start = 3315854779
start_date_string = "Thu Jan 27 17:46:19 2005"
last_actualisation = 3315855694
last_actualisation_date_string = "Thu Jan 27 18:01:34 2005"
next_actualisation = 3315855754
next_actualisation_date_string = "Thu Jan 27 18:02:34 2005"

[weather_picture]
comment = "-1=not valid, 0=rain, 1=cloud, 2=sun"
number = 1

[weather_tendency]
comment_1 = "-1=not valid, 0=no change of air pressure"
comment_2 = " 1=air pressure rising, 2=air pressure falling"
number = 0

[indoor_temperature]
deg_C = "20.2"
deg_F = "68.3"

[outdoor_temperature]
deg_C = "-15.8"
deg_F = "3.5"

[indoor_humidity]
percent = "43"

[outdoor_humidity]
percent = "19"

[dewpoint]
deg_C = "OFL"
deg_F = "OFL"

[windchill]
deg_C = "-15.8"
deg_F = "3.5"

[wind_speed]
mps = "0.0"
kmh = "0.0"
mph = "0.0"
knt = "0.0"
bft = " 0"

[wind_direction]
deg = "22.5"
name = "NNE"

[rain_total]
mm = "0.0"
inch = "0.00"

[rain_24h]
mm = "0.0"
inch = "0.00"

[rain_1h]
mm = "0.0"
inch = "0.00"

[pressure_absolute]
hpa = "1017.5"
inHg = "30.04"

[pressure_relative]
hpa = "2748.1"
inHg = "81.15"

[storm_alarm]
comment = "-1=not valid, 0=storm alarm not activ, 1=storm alarm activ"
number = 0

Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Mon, 21 Feb 2005 16:10:49 -0500, "JamesLomuscio"
<ja***********@aol.com> wrote in comp.lang.c++:
To all who know C++,

Im working on a prog that will be able to predict the weather, its too
complicated to go into here, but I do need some help.
We'll be glad to help.
I need to grab all of the information in the file currdat.lst that is in
quotes and store them in variables. Sounds simple enough, right? This area
of my prog. is complete garbage, so I wont bother to post it.
If you don't show us your code, how can you expect us to offer you
advice on correcting it?
For anyone interested in helping, the next line is line one of
More than a few here would be interested in helping, but probably none
interested in writing your code for you.
currdat.lst
[header]
programm_name = "heavy weather"
programm_version = "Ver. 2.0 beta release"
file_name = "currdat.lst"
file_format_version = "ver. 1.0"


[snip]

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 23 '05 #2

P: n/a
On Mon, 21 Feb 2005 16:10:49 -0500, JamesLomuscio <ja***********@aol.com>
wrote:
To all who know C++,

Im working on a prog that will be able to predict the weather, its too
complicated to go into here, but I do need some help.

I need to grab all of the information in the file currdat.lst that is in
quotes and store them in variables. Sounds simple enough, right? This
area
of my prog. is complete garbage, so I wont bother to post it.

For anyone interested in helping, the next line is line one of
currdat.lst
[header]
programm_name = "heavy weather"
programm_version = "Ver. 2.0 beta release"
file_name = "currdat.lst"
file_format_version = "ver. 1.0"


[...]

where is the problem?
use std::ifstream, getline(), and parse the strings / lines you get.
for parsing, you may want to use the various std::string::find*()
methods...
Jul 23 '05 #3

P: n/a

"JamesLomuscio" <ja***********@aol.com> wrote in message
news:1b******************************@localhost.ta lkaboutprogramming.com...
To all who know C++,

Im working on a prog that will be able to predict the weather, its too
complicated to go into here, but I do need some help.

That's a pretty lofty goal! Especially considering that the most powerful
computers in the world are used for such tasks, and the code for such has
been developed over decades of painstaking research and analysis.
I need to grab all of the information in the file currdat.lst that is in
quotes and store them in variables. Sounds simple enough, right? This area
of my prog. is complete garbage, so I wont bother to post it.


Are you on the Windows platform? That data looks just like an INI file to
me. If so, there is functionality in the Windows API (and in the Visual C++
libs) specifically for reading INI files. If that's your platform+compiler,
check the VC+ docs or the Windows API docs, or ask in a windows-related
newsgroup. That'll probably be easier than writing the parsing code
yourself.

But if you want help with the parsing code, you need to make a stab at it
yourself, and come back here if/when you have language-related issues with
what you've written. If the code is complete garbage, then you probably
need to re-design it entirely, and then re-write it. Look into streams.
There are many examples of reading from streams which you can find via a
search of groups.google.com. (We're certainnly not going to re-write your
non-posted, garbage code for you!)

-Howard

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.