English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 19 April 2009, 14:12   #1
Brakus
Registered User
 
Brakus's Avatar
 
Join Date: Feb 2008
Location: Sydney, Australia
Age: 54
Posts: 100
File search with C

Jeeez I'm crap

I knew I was rusty but this is beyond rusty!

I've written a quick function to search for 2000 files through 27 directories...

Maybe I should have spent a little more time on it because in 50 mins it's only found 227 of the 2000!!!
Brakus is offline  
Old 19 April 2009, 14:24   #2
prowler
Global Moderator
 
prowler's Avatar
 
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
Quote:
Originally Posted by Brakus View Post
I've written a quick function to search for 2000 files through 27 directories...

Maybe I should have spent a little more time on it because in 50 mins it's only found 227 of the 2000!!!
Hi Brakus,

If this is a quick function, what's the slow one like?
prowler is offline  
Old 19 April 2009, 14:44   #3
Brakus
Registered User
 
Brakus's Avatar
 
Join Date: Feb 2008
Location: Sydney, Australia
Age: 54
Posts: 100
Quote:
Originally Posted by prowler View Post
Hi Brakus,

If this is a quick function, what's the slow one like?
. Allow me to rephrase:


I've hastily written a function which is neither quick or functional !
Brakus is offline  
Old 22 April 2009, 01:24   #4
mr_0rga5m
Tik Gora :D
 
mr_0rga5m's Avatar
 
Join Date: Oct 2001
Location: Round yo momma's
Posts: 1,273
Brakus - Its not doing something mistakenly like once its found a file it goes back to the start position and searchs onwards thru all its just dismissed in the previous search until it finds the next file ? etc...

Perhaps you want to past some code for our perusal ?
mr_0rga5m is offline  
Old 22 April 2009, 01:35   #5
prowler
Global Moderator
 
prowler's Avatar
 
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
Quote:
Originally Posted by mr_0rga5m View Post
Brakus - Its not doing something mistakenly like once its found a file it goes back to the start position and searchs onwards thru all its just dismissed in the previous search until it finds the next file ? etc..
That's a fair suggestion. I wrote an iterative program once which converged slower than expected. It turned out to have a similar type of bug.

Quote:
Originally Posted by mr_0rga5m View Post
Perhaps you want to past some code for our perusal ?
That's a good idea too.
prowler is offline  
Old 15 May 2009, 02:17   #6
Brakus
Registered User
 
Brakus's Avatar
 
Join Date: Feb 2008
Location: Sydney, Australia
Age: 54
Posts: 100
Sorry gents, missed your replies...

I'm at work so can't post the actual code, but it checks each file against 27 directories eg.

Code:
 
while(!FILE && x<27)
{
strcpy(path,directory[x])
strcat(path,filename)
FILE = fopen(path,r)
x++;
}
Don't laugh, I know it's messy ( and obviously inneficient!)

I've put this to a side for a moment while I finish some other bits of the app. but will have to get back to it soon
Brakus is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
PD search DeafDaz request.Other 3 13 August 2011 01:10
File .NFO & file ID.diz stuff.... How To..!! DC33 support.Other 4 11 March 2009 10:21
Running non .adf file, .info file?? ypestis New to Emulation or Amiga scene 5 29 March 2006 18:53
no game for search.. Joe Maroni Games images which need to be WHDified 5 08 May 2004 01:29

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12686 seconds with 13 queries