April 13, 2024, 04:54:28 AM
Welcome,
Guest
Home
Help
Search
Login
Register
Recovery
xboxscene.org forums
>
OG Xbox Forums
>
Software Forums
>
Development
>
Dir Searching
« previous
next »
Pages: [
1
]
Print
Author
Topic: Dir Searching (Read 30 times)
razorrifh
Archived User
Sr. Member
Posts: 329
Dir Searching
«
on:
January 02, 2004, 07:44:00 AM »
Logged
Carcharius
Archived User
Sr. Member
Posts: 304
Dir Searching
«
Reply #1 on:
January 04, 2004, 01:09:00 PM »
CODE
HANDLE hFind;
WIN32_FIND_DATA oFind;
hFind = FindFirstFile("yourdirpath\*.*", &oFind);
if(hFind != INVALID_HANDLE_VALE)
{
do
{
// you can get filename and attributes of files using the oFind object
// e.g. filename would be oFind.cFilename
// so here you can do whatever you need to do with them
}while(FindNextFile(hFind, &oFind));
}
Some of those parameters/syntax might not be exact. But it'll be along those lines. Checkout those function names in help for more details.
Hope that helps
Carcharius
Logged
razorrifh
Archived User
Sr. Member
Posts: 329
Dir Searching
«
Reply #2 on:
January 05, 2004, 05:08:00 AM »
CODE
WIN32_FIND_DATA wfd;
HANDLE s = FindFirstFile(argc[0], &wfd);
if(s == INVALID_HANDLE_VALUE)
{
cout << "DIDNT WORK!";
return 0x01;
}
else
{
cout << "DID WORK!!";
return 0x02;
}
FineClose(s);
and i'd use the findnextfile func to find the rest of the stuff, but i want a way to do it with the standard libs, so i could port it to the xbox, and try to port it to other systems, (and cuz i dont wanna include windows.h
)
*edit* anyone know some good c++/windows programming forums? i dont wanna post stuff that noone is interested here.
Logged
Wishi
Archived User
Full Member
Posts: 191
Dir Searching
«
Reply #3 on:
January 05, 2004, 05:53:00 AM »
The code Carch posted would work on the Xbox and to use it you only need to include xtl.h as usual. Maybe you could do this with SDL I don't know.
Logged
razorrifh
Archived User
Sr. Member
Posts: 329
Dir Searching
«
Reply #4 on:
January 05, 2004, 07:50:00 AM »
@ wishi:
ok, thanks for the info. i havent bothered to relocate the xdk after my last hd crash so i was unable to look up this info in the help file.
@all:
i'll just stick with this code for now, i'm just trying to get an alpha build to work thats functional so i can always improve it from there. later!
Logged
Wishi
Archived User
Full Member
Posts: 191
Dir Searching
«
Reply #5 on:
January 05, 2004, 07:52:00 AM »
It is a Win32 function I know, however it's on Xbox also which I mentioned since this is a development forum for Xbox. It obviously would not be portable to other platforms since it uses the structure WIN32_FIND_DATA.
Logged
Carcharius
Archived User
Sr. Member
Posts: 304
Dir Searching
«
Reply #6 on:
January 06, 2004, 04:29:00 AM »
Dirent isn't in the XDK.
But I have seen a port of it to Win32 that should work.
I can't remember where I saw it though - am sure google will be able to help.
Carcharius
Logged
Print
Pages: [
1
]
« previous
next »
xboxscene.org forums
>
OG Xbox Forums
>
Software Forums
>
Development
>
Dir Searching