Latest Uploads
PixeLink P ... zle Editor

rockford

PixeLink

rockford

image-21-0 ... -21-29.jpg

Jayenkai

image-15-0 ... -19-40.jpg

Jayenkai

image-15-0 ... -20-07.jpg

Jayenkai

Bumble Bee

dna

Forum Home

searching the directory for a file.

UserMessage
Posted : Tuesday, 18 January 2011, 18:24 | Permalink
dna


Can someone check my syntax.

I looked at the sample and for some reason I cannot figure out my error.

-->

I'm trying to match the name.

-----
DNA
Posted : Tuesday, 18 January 2011, 20:21 | Permalink | Mark Here
dna



I updated the loop, found it is going through the loop, checking names, but stopping at a particular name while giving the error "parameter must be positive".

-->

-----
DNA
Posted : Wednesday, 19 January 2011, 02:53 | Permalink | Mark Here
j\'ordos


Why not put a print or debuglog before the line it crashes? I guess that error comes from the left$() command, one of the filenames might have a . at it's start. Do the '..' and '...' "files" get pruned out by checking for folders? (filetype=2)
Posted : Wednesday, 19 January 2011, 04:55 | Permalink | Mark Here
HoboBen


WW Entries : 9
T=Instr(DF$,"."):TR$=Left$(DF$,T-1)

This bit looks suspect. Perhaps check to make sure that T > 1

-----
Posted : Wednesday, 19 January 2011, 16:20 | Permalink | Mark Here
dna


There's still a problem in it.

Here is the current source.

-->

The program hangs for some reason.

GE$ is the directory location while GH$ is the name for which you're searching .

-----
DNA
Posted : Thursday, 20 January 2011, 04:41 | Permalink | Mark Here
HoboBen


WW Entries : 9
What does HALT(11) do?

I think on line four you'll need something like

If DF$="" Then Return ""

Because on line three, DF$=NextFile will set DF$ to "" when there is no next file left in the directory.

-----
Posted : Thursday, 20 January 2011, 10:06 | Permalink | Mark Here
dna


You're right about the NULL. I'm not checking for that.

Here's the routine that I got to work thus far.

-->

The HALT(11) is a routine for stopping the program at a spot to view the variables.

I also need to re write the routine for checking the names. The line LEFT$(DF$,LEN(GH$))=GH$ works but if you truncate your input, something like: 'pa' instead of 'pau', it finds the first occurance of 'pa', which is the wrong file.

-----
DNA
Posted : Thursday, 20 January 2011, 11:15 | Permalink | Mark Here
dna


Here it is.
-->

This works having known the full complete name of the file. Partial names or any form of search for the name is not included yet.


-----
DNA
Posted : Thursday, 20 January 2011, 11:27 | Permalink | Mark Here
Orion Pax


WW Entries : 2
-->

and in your program put
IF GET_NAME$("C:\MYDIR","MYFILE.EXT")=" " then DO THIS

its been a while since I dabbled in b3d/2d but its like riding a bike. I just need to look over the docs on the site and I get the idea again.
Homepage : http://www.3dstormgames.com
Posted : Thursday, 20 January 2011, 18:59 | Permalink | Mark Here
dna


Oh.
I never knew you could embed a function name inside of a conditional statement!

That could shorten the program quite a bit.


-->

I was using at the top of the program which, though it logically does the same thing, makes the program a bit longer than doing it your way.

Also, does the statement
-->
require the argument RETURN "" inside the function or does it return automatically?

-----
DNA
Posted : Thursday, 20 January 2011, 20:06 | Permalink | Mark Here
Orion Pax


WW Entries : 2
Yes it still requires the RETURN " "! The RETURN command is ALWAYS needed when using functions or else there is no way to exit from them. The RETURN command also gives you a chance to RETURN a value back on exit. For example RETURN "1234" in a function would RETURN the string (I think since it has quotes) "1234". So A$=My_Function$() with a RETURN "1234" would be A$="1234". To do a numerical value omit the quotes.

With all that being said you could also as well do this... RETURN TRUE or RETURN FALSE, and with if statements you could do a lot with it. IF My_Function() Then DO THIS and the function could RETURN TRUE or RETURN FALSE! If true then the DO THIS would execute. False and it wont.

Uhhgg....I dont have b3d installed and I cant remember how b3d declares its variables...strings are $....what are # and %???? There are 3 types of variables...and I cant remember EXACTLY what the other 2 are called! Asking because I THINK functions have to be declared according to the type of info its going to return....I think...been a while. I know if its a string you HAVE TO HAVE a $ or it wont work. Dunno about the other 2.....

*EDIT*
Integers % (symbol not needed)
Floating point # (Symbol needed)
For some reason I was thinking there was a boolean version too...
Homepage : http://www.3dstormgames.com
Posted : Thursday, 20 January 2011, 20:08 | Permalink | Mark Here
dna


I ed your syntax and it threw the program out for some reason. I may need to change some other things for that to work.

It jumps into a loop.

-----
DNA
Posted : Thursday, 20 January 2011, 20:13 | Permalink | Mark Here
Orion Pax


WW Entries : 2
In your example the code box has " " and below that you have "", you have to make sure that it matches. If that makes sense? If your looking for " " make sure your returning " "!

Might be why....post your code for it and I will see where your looping.
Homepage : http://www.3dstormgames.com
Posted : Thursday, 20 January 2011, 20:50 | Permalink | Mark Here
dna


This appears to be the final syntax.
-->

It works in that subroutine.

-----
DNA
Posted : Thursday, 20 January 2011, 21:13 | Permalink | Mark Here
Orion Pax


WW Entries : 2
the .N_FI and goto N_FI are redundant as that is what the repeat until commands do. And you dont have to look for filetype 2 since your looking for a file. But unless you have a directory with a similar name you might need it. But other than that it will work.

If you have any issues, post some of the code around where the function is being called and I'll have a look at it. At any rate its WAY past my bed time!
Homepage : http://www.3dstormgames.com
Latest Posts
Zero Hour Jam
steve_ancell Sat 06:12
Sweets
steve_ancell Sat 06:09
Merchandising : Window Shopping
Kuron Sat 04:58
New Mac woes
Kuron Fri 16:12
Corner Gas : The Movie
Jayenkai Fri 16:00
RIP : Jay's Nan
blanko1324 Fri 15:35
HoverBoards FTW!
steve_ancell Fri 15:04
Facebook Rooms
Jayenkai Fri 10:37
Grrrrr Nintendo!....
rockford Fri 09:17
Willpower
rychan Fri 06:53
More

Latest Items
Woot : Update on hand issues
Kuron Fri 10:34
News : Newsletter #240
steve_ancell Fri 05:29
Techy : My Newest Toys
Jayenkai Sun 04:16
News : Newsletter #239
Jayenkai Sat 05:34
Showcase : Preppie!
Jayenkai Fri 13:00
Rant : I Stubbed My Toe...
steve_ancell Tue 09:47
Blog : Bedroom 2.0
Kuron Mon 18:59
Link : Message(s) from the grave
Jayenkai Tue 09:27
Blog : 20 Years Ago....
steve_ancell Mon 15:28
Life : Back Online
Kuron Tue 11:48
Showcase : Munky Blocks DX
Jayenkai Mon 07:06
Showcase : Little Nemo's Nightmare
Jayenkai Sat 04:14
News : Newsletter #234
rychan Fri 08:02
Showcase : Space Rocket Adventurers
HoboBen Thu 16:56
Blog : Health Update : August 2014
Jayenkai Sat 11:31
More

Who's Online
steve_ancell
Sat, at 06:13
Jayenkai
Sat, at 06:08
Kuron
Sat, at 05:42
rychan
Sat, at 05:12
Krakatomato
Sat, at 04:34
spinal
Sat, at 00:17
blanko1324
Fri, at 22:31
shroom_monk
Fri, at 15:38
rockford
Fri, at 14:14
dna
Fri, at 12:53
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.