123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|564|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> Stuck in a loop (aka yet another stupid question from spinal)

Sat, 17 Nov 2007, 19:06
spinal
My head hurts, this stupid txt reader won't exit.
Can someone take a look and tell me whats jamming it? This sort of thing would be a lot easier if I knew what I was doing.



-=-=-
Check out my excellent homepage!
Sat, 17 Nov 2007, 19:30
Jayenkai
That's far too baffling at this time of night! I'll have a proper look at it all in the morning. (sorry!)

-=-=-
''Load, Next List!''
Sun, 18 Nov 2007, 03:18
power mousey



have you set up debugging methods
and run step by step methods to print the values
of such variables and qualities like 'exxit'
and also 'current_pos' and 'length_of_file-1'
and perhaps other ones too??

okay, one thing I see is this:

if the Pad.Held.B is true then exxit=1
which I assume will mean to exit...is this corect??

yet, what about those 2 while statements??

while(current_pos<length_of_file-1 && exxit==0)

while(temp<amount_to_read && exxit==0)




Sun, 18 Nov 2007, 04:46
spinal
The aim there is that once exit is true (1) then each while will give up what its doing and the function should end. As soon as exxit != 0 then the whole thing should end.

-=-=-
Check out my excellent homepage!
Sun, 18 Nov 2007, 05:16
Jayenkai
I can't see anything obviously wrong with it.
My only complaint is that the Pad.Held.B bit is in the Read-file loop, which only occurs every so often.
Perhaps placing that down in the main loop next to the Newpress.a bit might give better results.
if(Pad.Newpress.A){ok_to_exit=1;}
if(Pad.Held.B){ok_to_exit=1; exxit=1;}
?

-=-=-
''Load, Next List!''
Sun, 18 Nov 2007, 05:22
spinal
Tried that first, didn't work.
Sun, 18 Nov 2007, 05:29
spinal


Couple of changes, and I'm getting "exited function" at the top of my screen, so it does seem to finish the function, but it does not return to my menu

-=-=-
Check out my excellent homepage!
Sun, 18 Nov 2007, 05:34
Jayenkai
Aaah, well then in that case it's something in the menu that's at fault*. It must be constantly re-calling the reader function.



* This is an assumption, and although it feels like it could be right, it might not be!

-=-=-
''Load, Next List!''
Sun, 18 Nov 2007, 05:42
spinal
If your not doing much, I can send you the latest full source for the menu, see if you can spot anything. I'm going to drop into mud chat for a while.
|edit| It isn't actually exiting the function (that I can tell) The first thing its supposed to do after the txt reader is reload the bottom screen gif, it doesn't do that, it just freezes.

-=-=-
Check out my excellent homepage!
Sun, 18 Nov 2007, 09:10
power mousey

okay, I'm beggining to see a little
of whats going on.

But doesn't && mean and.
And if it does, then lets say you initiate
that Pad.Held.B for exit...and exxit=1

then in those while loops...lets say
current_pos is still less than length_of_file-1
also
that temp is still less than amount_to_read

just curious and wondering too.
Sun, 18 Nov 2007, 09:17
Jayenkai
while (This AND That)
So, basically as soon as exxit becomes 1, the loop is broken, because (This AND That) is no longer true.


-=-=-
''Load, Next List!''
Sun, 18 Nov 2007, 09:22
power mousey

duh!
duh!! on me.

thanks Jay, haven't coded in C/C++
for such a long time. I um forgot.
I thought it meant Or.