Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 5th Aug 2010 23:00 Edited at: 5th Aug 2010 23:37
Hello! I'm having a nightmare with this code that is designed to search for files. I've posted the whole module, as it is part of an rts. It's very highly commented, but if you look at this bit:



It is stuck in that loop somehow! It just keeps writing the same values to the array. There is only one item in the folder, which is "Britain".

files$(1) is equal to .
files$(2) is equal to ..
files$(3) is equal to Britain
then it repeats all the way to 1000

Surely it should report an error that the data of the file i want doesn't exist?

Or am i using the wrong method to detect the end of the directory?

Any help would be appreciated.
thanks

full code:



EDIT: It would seem the problem isn't what I thought it was, I forgot to take into account that the sync was outside that loop. I've forgotton to clear the array out. Sorry for making a pointless post.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Aug 2010 18:36
I always use FIND FIRST and FIND NEXT outside of the loop so that it gets rid of the . and .. right away so the FIND NEXT in the loop would pick up the first actual file.

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 6th Aug 2010 18:49
Thanks but I messed up the entire routine, i fixed one bug then ran into another :/

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 6th Aug 2010 18:54
Yes Grog, you can do that, I use "perform checklist for files".

The fastest code is the code never written.

Login to post a reply

Server time is: 2026-07-24 20:36:02
Your offset time is: 2026-07-24 20:36:02