Discussion of chess software programming and technical issues.
Moderator: Ras
Edmund
Posts: 670 Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain
Post
by Edmund » Sun Jul 11, 2010 12:18 pm
The new Glass release shall have extensive personalities features. In Windows I used the FindFirstFile / FindNextFile to look for personality files in a special folder and print them in the UCI engines dialog (therefor I need to add the files matching the pattern "*.ini" to a string). Is there a way to do this in Linux?
My current Windows function is the following:
Code: Select all
void options_find_personality(void) {
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
strcpy(personality_names, "var main");
hFind = FindFirstFile("personalities\\*.ini", &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) return;
strcat(personality_names, " var ");
strcat(personality_names, FindFileData.cFileName);
personality_names[strlen(personality_names)-4] = 0;
while(FindNextFile(hFind, &FindFileData)) {
strcat(personality_names, " var ");
strcat(personality_names, FindFileData.cFileName);
personality_names[strlen(personality_names)-4] = 0;
}
}
regards,
Edmund
Volker Annuss
Posts: 181 Joined: Mon Sep 03, 2007 9:15 am
Post
by Volker Annuss » Sun Jul 11, 2010 12:37 pm
Hi Edmund,
you can use opendir() and readdir() to read a directory and do the filtering for *.ini yourself.
And there is a scandir() that helps with filtering.
Greetings
Volker
Edmund
Posts: 670 Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain
Post
by Edmund » Sun Jul 11, 2010 12:49 pm
Volker Annuss wrote: Hi Edmund,
you can use opendir() and readdir() to read a directory and do the filtering for *.ini yourself.
And there is a scandir() that helps with filtering.
Greetings
Volker
Thanks for the instant reply Volker, I will have a look into these new functions.