Blue Frenzy Posted September 18, 2007 Report Share Posted September 18, 2007 I have some wrong events here. I have a file on txt format, and i want to read its values. There is an unknow numbre of objects. Each object has some data. The way I organize it on txt is like this: -each data is separated by " * " -each object is separated by " ¡ " -File end is marked by " $ " so, i have something like this: 0*15000*96*128*-1*0*¡0*18750*96*128*-1*1*¡0*20600*96*128*-1* 1*¡0*21750*64*128*-1*0*¡0*22250*152*128*-1*0*¡0*22500*152*128*-1 *0*¡0*25550*88*24*-1*0*¡0*25800*88*56*-1*0*¡0*26250*88*56*-1*0*¡0* 26900*88*56*-1*0*¡0*28100*168*232*-1*1*¡0*28300*168*232*-1*0*¡0*28850* 136*200*-1*0*¡0*29400*96*128*-1*1*¡0*29750*96*128*-1*0*¡0*30000* 128*128*-1*0*¡0*30250*128*128*-1*0*¡0*30750*64*128*-1*0*¡ NOTE: on screenshots appears the " ! " symbol instead " ¡ " but now it is fixed, still doesnt work. I store each value in some list objects. so, in list 1, it stores the first value. In list 2 it stores the 2nd value, etc... so, each line is a different object and each list is a different value. NOTE 2: Note that not always the 5th value appears so, if there is no 5th value i put a value 0 on the list. NOTE 3: there are 2 counters, one stores the value, and the other stores the current data position, so, if counter is = 2, it means i have to add the value to the 3rd field. each " * " means a different field so I add one to the counter and reset the first counter to store a new value. well, it doesn't work. It just appears an unique "0" Here is the code. any help on finding what could be wrong? Link to comment Share on other sites More sharing options...
Damizean Posted September 18, 2007 Report Share Posted September 18, 2007 Well, you're using MMF. That should be it. Link to comment Share on other sites More sharing options...
GSF Posted September 18, 2007 Report Share Posted September 18, 2007 The system is too complicated, you could try with arrays. Link to comment Share on other sites More sharing options...
LarkSS Posted September 18, 2007 Report Share Posted September 18, 2007 I believe MMF gets upset if the loop length grows above 100. I agree with gsoft on using arrays, though maybe if you divide the big "load" loop into smaller loops MMF might actually do the process correctly. *shrugs* Btw, instead of saying to directly check the character number equal to the loop index of "load", did you try setting a counter to the loop index of "load" and then using the value of the counter to compare what character to look at? I believe that strangely fixed a problem for me once. Link to comment Share on other sites More sharing options...
Damizean Posted September 18, 2007 Report Share Posted September 18, 2007 Anyway, why not use two separated string parser objects? You could easily split up data that way. Link to comment Share on other sites More sharing options...
Blue Frenzy Posted September 18, 2007 Author Report Share Posted September 18, 2007 I cannot be limited to 100 loops anyway. There is another way of make a "while" function? I don't care on loading times. Also, i need to use the list object for making that user could select it. Link to comment Share on other sites More sharing options...
GSF Posted September 18, 2007 Report Share Posted September 18, 2007 You could try with the string parser, like Damizean says. Or try arrays, or ini (ini only supports a max of 64 kb) Link to comment Share on other sites More sharing options...
Blue Frenzy Posted September 19, 2007 Author Report Share Posted September 19, 2007 I use string parser to store the txt file. the problem comes when splitting it. I have no problems on storing values, at least for now. The problem is reading the txt. Link to comment Share on other sites More sharing options...
Blue Frenzy Posted September 19, 2007 Author Report Share Posted September 19, 2007 Ok, fixed thanks to damizean. This can be closed. Link to comment Share on other sites More sharing options...
Recommended Posts