![]() |
|
How to search for files |
Kikaru
Member #7,616
August 2006
![]() |
How should I go about searching for different files in a directory, such as all files of one extension, without user input? |
CGamesPlay
Member #2,559
July 2002
![]() |
-- Ryan Patterson - <http://cgamesplay.com/> |
Kikaru
Member #7,616
August 2006
![]() |
Thanks. Just one last question: with for_each_file_ex, is it possible to limit it to one directory, such as the same one as the .exe? |
CGamesPlay
Member #2,559
July 2002
![]() |
Yes. It doesn't recurse into subdirectories in the first place. -- Ryan Patterson - <http://cgamesplay.com/> |
Kikaru
Member #7,616
August 2006
![]() |
Ok. Thanks. So, to find .sav files in a folder named SAVES in the directory as my game, I would do this: for_each_file_ex("SAVES//*.sav", ..., my_callback, ...); ? |
LennyLen
Member #5,313
December 2004
![]() |
Quote: for_each_file_ex("SAVES//*.sav", ..., my_callback, ...); Yes, except that you would specify the directory as "SAVES/*.sav" (or under DOS/Windows "SAVES\*.sav").
|
Kikaru
Member #7,616
August 2006
![]() |
Oh. Yeah, I use windows and forgot which way the slashes went. Thanks for the help! |
BAF
Member #2,981
December 2002
![]() |
You might as well use /. It's more readable IMO because it doesn't require escaping, and it is cross-platform (unlike \). |
Kikaru
Member #7,616
August 2006
![]() |
'\\' is for windows. I don't think '/' works on windows though. |
LennyLen
Member #5,313
December 2004
![]() |
Quote: I don't think '/' works on windows though Yes it does.
|
|