Back to BeeGuid Source

int scanOfAvailableValuesOfGen(int nNumberOfGenInTableFun)
{
    int nextFindFile = 1,
        nextValueGenFun = 1;
    wchar_t *wtext;
    wtext = L"Database\\BeesGeneticCards\\*.txt";
    LPWSTR kDir = wtext;
    WIN32_FIND_DATA beeFileData;
    HANDLE f;
    f = FindFirstFile(kDir, &beeFileData);
    if (f != INVALID_HANDLE_VALUE)
    do
    {
        WCHAR *beeFileName = beeFileData.cFileName;
        //Converts wchar into char *
        char    beeFileName2[255],
                DefChar = ' ',
                fileName[255];
        WideCharToMultiByte(CP_ACP, 0, beeFileName, -1, beeFileName2, 260, &DefChar, NULL);
        int        fileNameLen;
        fileNameLen = strlen(beeFileName2) - 4;
        strncpy_s(fileName, beeFileName2, fileNameLen);
        string    sFiles = "Database\\BeesGeneticCards\\";
        sFiles = sFiles + beeFileName2;
        ifstream in(sFiles);
        for (int i = 1; i <= nNumberOfGenInTableFun; i++)
        {
            int h;
            char valueGen[255];
            in.getline(valueGen, 40);
            if (i == nNumberOfGenInTableFun) //If found line needed
            {
                if (valueGen != msValueGen[nextValueGenFun]) //Searching value of gen in db
                {
                    for (int b = 1; b < nextValueGenFun; b++)
                    {
                        if (valueGen == msValueGen[b]){ h = 1; }
                    }
                    if (h != 1)
                    {
                        msValueGen[nextValueGenFun] = valueGen;
                        nextValueGenFun++;
                    }
                    h = 0;
                }
            }
        }
        nextFindFile++;
        in.close();
    } while (FindNextFile(f, &beeFileData));
    FindClose(f);
    return nextValueGenFun;
}

Опрос

Оцените мой сайт
Всего ответов: 55

Статистика



Онлайн всего: 1
Гостей: 1
Пользователей: 0



Radio