codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Parsing Data  potatos4life at 02:03 on Friday, November 27, 2009
 

Hi everyone I'm new to c++ and I'm trying to parse this data which I thought wouldn't be too difficult but I've been at it for quite some time now and with still no luck. Anyways here is my problem I have a data set that looks like this, it starts with and includes the space above underscore,

___________________________________________________
Profile Time: 3 4 15 20 0
Profile Location: 89.72 -90.02 (150, 69)

MSLP TMPS TPP3 CPP3 SOLT SOLW T02M RH2M U10M V10M P10M PRSS WESD CSNO CICE CFZR CRAI LHTF SHTF USTR
VSBY RGHS LCLD MCLD HCLD TCLD DSWF WTMP CAPE CINH LISD LIB4
hPa

1015 1018 35.8 0 0 297 648 24.5 44.9 -0.53 -1.6 295 1015 0 0 0 0 0 202 362 0.60 24252 1.1 0 0 0 0 984 309 0 4.7 276 3.2

UWND VWND HGTS TEMP WWND RELH TKEN TPOT WDIR WSPD
m/s m/s oC mb/h % oK deg m/s
1000 -1.4 0.78 150 20.3 -0.23 52.7 2.8 293.4 128.2 1.6
975 -1.5 0.11 368 17.8 -1.5 58.7 3.1 293.0 102.9 1.5
950 -1.2 -0.98 589 15.7 -2.6 68.8 3.1 293.1 60.4 1.6
925 -0.71 -1.9 816 13.7 -2.2 81.0 2.9 293.3 29.5 2.0
900 0.15 -2.4 1046 11.7 -1.5 91.0 2.6 293.6 5.3 2.4
875 0.82 -3.8 1281 10.0 0 76.0 2.1 294.2 356.5 3.9
850 0.31 -3.7 1522 9.5 1.7 59.0 0.20 296.1 4.1 3.7
825 -0.63 -2.9 1769 8.0 1.9 61.0 0.20 297.0 21.0 3.0
800 -1.9 -2.9 2022 6.4 4.6 70.0 0.20 298.0 42.1 3.5
775 -3.5 -3.0 2282 5.7 6.1 79.0 0.20 299.9 57.9 4.6
750 -4.9 -3.5 2550 4.5 5.2 81.0 0.20 301.4 63.3 6.0
725 -5.9 -4.2 2825 2.5 5.7 76.0 0.20 302.2 63.4 7.2
700 -6.3 -4.4 3108 0.58 5.9 68.0 0.20 303.1 63.6 7.7
650 -6.2 -3.1 3699 -2.6 6.3 72.0 0.20 306.1 72.4 6.9
600 -5.9 -2.4 4330 -5.9 6.5 65.0 0.20 309.3 76.8 6.4
550 -5.2 -2.2 5007 -9.4 6.0 58.0 0.20 312.9 76.1 5.6
500 -5.8 -2.6 5737 -14.1 5.1 72.0 0.20 315.8 74.6 6.3
450 -7.5 -3.7 6527 -19.9 5.3 65.0 0.20 318.3 73.0 8.4
400 -7.4 -4.5 7389 -26.4 3.5 32.0 0.20 320.7 67.7 8.6
350 -3.8 -2.3 8340 -33.7 3.3 33.0 0.20 323.3 68.0 4.5
300 1.5 3.9 9400 -42.2 3.3 32.0 0.20 325.9 209.7 4.1
250 4.8 5.2 10608 -50.9 1.7 33.0 0.20 330.4 231.1 7.1
200 2.5 3.7 12046 -53.1 0 18.5 0.21 348.7 222.9 4.4
150 -3.1 1.3 13898 -54.2 -1.1 5.1 0.20 376.8 121.3 3.3
100 -3.3 3.6 16467 -58.5 -0.49 3.1 0.20 414.6 146.8 4.9
50 -3.1 1.7 20798 -60.4 -0.35 0 0.20 501.1 127.1 3.6

So this thing I've posted above repeats itself 120 times throughout the text file. However, all I need is that data in between shown here:

1000 -1.4 0.78 150 20.3 -0.23 52.7 2.8 293.4 128.2 1.6
975 -1.5 0.11 368 17.8 -1.5 58.7 3.1 293.0 102.9 1.5
950 -1.2 -0.98 589 15.7 -2.6 68.8 3.1 293.1 60.4 1.6
925 -0.71 -1.9 816 13.7 -2.2 81.0 2.9 293.3 29.5 2.0
900 0.15 -2.4 1046 11.7 -1.5 91.0 2.6 293.6 5.3 2.4
875 0.82 -3.8 1281 10.0 0 76.0 2.1 294.2 356.5 3.9
850 0.31 -3.7 1522 9.5 1.7 59.0 0.20 296.1 4.1 3.7
825 -0.63 -2.9 1769 8.0 1.9 61.0 0.20 297.0 21.0 3.0
800 -1.9 -2.9 2022 6.4 4.6 70.0 0.20 298.0 42.1 3.5
775 -3.5 -3.0 2282 5.7 6.1 79.0 0.20 299.9 57.9 4.6
750 -4.9 -3.5 2550 4.5 5.2 81.0 0.20 301.4 63.3 6.0
725 -5.9 -4.2 2825 2.5 5.7 76.0 0.20 302.2 63.4 7.2
700 -6.3 -4.4 3108 0.58 5.9 68.0 0.20 303.1 63.6 7.7
650 -6.2 -3.1 3699 -2.6 6.3 72.0 0.20 306.1 72.4 6.9
600 -5.9 -2.4 4330 -5.9 6.5 65.0 0.20 309.3 76.8 6.4
550 -5.2 -2.2 5007 -9.4 6.0 58.0 0.20 312.9 76.1 5.6
500 -5.8 -2.6 5737 -14.1 5.1 72.0 0.20 315.8 74.6 6.3
450 -7.5 -3.7 6527 -19.9 5.3 65.0 0.20 318.3 73.0 8.4
400 -7.4 -4.5 7389 -26.4 3.5 32.0 0.20 320.7 67.7 8.6
350 -3.8 -2.3 8340 -33.7 3.3 33.0 0.20 323.3 68.0 4.5
300 1.5 3.9 9400 -42.2 3.3 32.0 0.20 325.9 209.7 4.1
250 4.8 5.2 10608 -50.9 1.7 33.0 0.20 330.4 231.1 7.1
200 2.5 3.7 12046 -53.1 0 18.5 0.21 348.7 222.9 4.4
150 -3.1 1.3 13898 -54.2 -1.1 5.1 0.20 376.8 121.3 3.3
100 -3.3 3.6 16467 -58.5 -0.49 3.1 0.20 414.6 146.8 4.9
50 -3.1 1.7 20798 -60.4 -0.35 0 0.20 501.1 127.1 3.6

I have a few problems, the data is located in something called "/forum/jd1.txt" and I have no problem loading it, but exporting it I don't know, that's honestly the least of my concerns though I can't get it to the format I want it, they stay consistent, there are 13 header lines(it is 13 though it got messed up in the format when I pasted it here) and 26x11 strings of data in each of those blocks I want, which repeat themselves 120x, so this is what I got:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{

ifstream ifile;
ofstream ofile;
string file_name = "/forum/jd1.txt";
string word="";

ifile.open(file_name.data(), ios::in);
ofile.open("/forum/filtering.txt");

while(!ifile.eof())
{

for(int i=0;i<120;i++)
{
for(int i=0;i<13;i++)
{
ifile.ignore(INT_MAX, '\n');
}
for(int i=0;i<286;i++)
{
ifile>>file_name;
cout<<file_name<<" ";
}
}
}

ifile.close();
ofile.close();
return 0;

}

right now obviously it's not exporting but i'd like for it to as well. Right now it just outputs a bunch of numbers string by string. which is kind of what I want. I'm very lost haha. Any help would be very appreciated. Thanks Again

-potato






  Re: Parsing Data  moontech at 03:07 on Thursday, January 20, 2011
 

Your issue looks interesting. I want to help you with a method of data export. It's very fast and stable when you export data from database. You may visit here for further information:
http://www.e-iceblue.com/Introduce/free-dataexport-component.html








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Layer & Drop Downs - Expertise Needed
•  Re: onmouseover change image and text
•  Re: what is the different
•  help for newbie -- VB macro in Excel
•  Re: Help with 2 level tab menu
•  Re: Firefox/IE doctype problem.
•  form with radio buttons to hide fields
•  Re: Need some help
•  cUrl yahoo login,mail verification problem. please help!


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2011