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.

DarkBASIC Professional Discussion / checklist for files problem

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 4th Dec 2011 21:25
there is a problem when i want to print out all files from the checklist first two are "." and ".." and because of this last two files are not in the list how can i skip this two so i can get all the files from the checklist



checklist returns 63 (like in my folder) but with "." and ".." no errors or anything, it is supposed to be 63 without "." and ".."
Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 4th Dec 2011 22:01
Dont you need to use DIM FileNames$(number of file names)?

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 4th Dec 2011 22:06
yes i do use DIM FileNames$(255)
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Dec 2011 22:07
The problem seems to be in the code.

You loop through the checklist (correctly:
for t=1 to CLQuantity

You have NumberInList starting from 0 and being incremented every time you add a file to your list (correctly).

You load the images you've detected (incorrectly)
for t=3 to NumberInList
img=find free image()
load image FileNames$(t),img,0,quality#
next t

Your loop should start at zero, and as you post-increment your NumberInList variable, it should loop to NumberInList-1.

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 4th Dec 2011 22:14
well if it is
for t=1 to NumberInList then dbp load image doesn't trigger error and "loads" "." and ".." like images, if it is t=0 then error is triggered with image doesn't exist so i used t=3
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Dec 2011 20:13
I've misread your code. That raises the question of why you have the first and third loop simply copying the filenames into an array without filtering, and the second loop looking for images but doing nothing with them (relatively speaking).

Anyway, here's my (incomplete) interpretation of what you are trying to do:


You'll need to adapt it to fit your program and to add the bits I didn't see the need to code in this example.

Login to post a reply

Server time is: 2026-07-10 23:12:42
Your offset time is: 2026-07-10 23:12:42