A weird runtime error

Hello.
I am having a very bizarre runtime error at a line. I myself couldn't really deduce anything useful about the error. Here is the full source code:
http://pastebin.com/xrtDrDMdP

So the code opens a .txt file, and extracts info from various tags. The runtime error seems to come from this part:
1
2
3
4
5
6
7
8
9
10
11
12
                                          while (ice==3 && (frameline.rfind(tags[ice])!=string::npos) && !extraction){  
                                                   
                                                if (triggahcomma==0){  //WALKSPDX
                                                    if(frameline.substr(food+positions[ice],1).find(",")!=string::npos){triggahcomma =1;}else if (isdigit(frameline[food+positions[ice]])){tempariro+=(frameline.substr(food+positions[ice], 1).c_str());}
                                                    if (triggahcomma==1){wkspdx=atoi(tempariro.c_str()); tempariro = "";food++;}}
                                                
                                                if (triggahcomma==1){ //WALKSPDZ
                                                 
                                                   if(frameline.substr(food+positions[ice],1).find(",")!=string::npos){triggahcomma =2; /*this is the place where the code seems to stop working at. figured this out by placing a cout here.*/}else{tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());food++;cout<<frameline.substr(food+positions[ice],1)<<endl;}
                                                   if (triggahcomma==2){ wkspdz=atoi(tempariro.c_str()); tempariro = "";triggahcomma=0;extraction=true;food=1000; }}
                                                else{
                                                     food++;}}


So, what am I doing wrong this time :\.
Thanks in advance =)
(and I am sorry about the page stretch)


Edit: Never mind. Found the issue. I was incrementing food twice in during the check, and ergo, the program was trying to convert a comma to an int.
~Solved.
Last edited on
(and I am sorry about the page stretch)


Well it is considered bad style IMO to put multiple statements on 1 line.

Line 9 is the worst : It has a big comment in it as well.

Why do you do this ? If you are trying to save LOC, then don't :-)

Hope all is well at your end
Yeah its all working sweet and thanks. I am just convinced (when lots of people disagrees) that doing multiple statements in 1 line makes the code more readable and reduces the number of the lines of code. Not to forget to mention that I hate scrolling much to get to the specific portion of the code I am looking for. Now you will probably mention Including, but that's even worse; having lots of .h files will require more clicks and will even require me to move my hand from the keyboard waaay to the mouse, and that requires effort XP. I am such a lazy guy I know.. But I am pretty sure that I will someday learn it the hard way XD.
And thanks for reading my little rant =D.
And the commenting, .... enough already :P.
Last edited on
Topic archived. No new replies allowed.