I need help combining the file name with the filepath
my code:

WIN32_FIND_DATA FindData;
    HANDLE hFind;

    hFind = FindFirstFile(L"../art/*.dds", &FindData );

    if( hFind == INVALID_HANDLE_VALUE )
    {
        PrintCharS("Error searching directory");
        return;
    }

    do
    {

        char ch[260];
        char DefChar = ' ';
        WideCharToMultiByte(CP_ACP, 0, FindData.cFileName, -1, ch, 260, &DefChar, NULL);

        string ss(ch);

        if (ch != "invalid.dds")
        {

            WCHAR* path = L"../art/";
            //path = path + (WCHAR)ch;

            int size = strlen(ch);
            wchar_t* str;
            size_t length = 0; 
            mbstowcs_s(&length, str, ch, size+1);

            WCHAR* Path = path + str;

            PrintWCHARS(Path);

        }

    }
    while( FindNextFile(hFind, &FindData) > 0 );

All I would like is to get a WCHAR* with the filepath AND filename

Use wcscpy_s or wcscpy for widechars, which correspond to strcpy_s and strcpy for chars.

Note also you need buffers for these functions.

The Microsoft implementation includes the draft TR2 filesystem library.
(With other compilers, boost::filesystem which privides like functionality can be used.)

#include <iostream>
#include <string>
#include <vector>
#include <filesystem>
namespace fs = std::tr2::sys ;

std::vector<std::wstring> files_in_directory( fs::wpath path = L".", bool recursive = true )
{
    std::vector<std::wstring> files ;

    try
    {
        if( fs::exists(path) ) files.push_back( fs::system_complete(path) ) ;

        if( fs::is_directory(path) )
        {
            using iterator = fs::basic_directory_iterator < fs::wpath > ;
            for( iterator iter(path) ; iter != iterator() ; ++iter )
            {
                files.push_back( fs::system_complete( iter->path() ) ) ;
                if( recursive ) 
                    for( const std::wstring& p : files_in_directory( iter->path() ) )
                        files.push_back( std::move(p) ) ;
            }
        }
    }

    catch( const std::exception& ) { /* error */ }

    return files ;
}

int main()
{
    for( const std::wstring& path : files_in_directory( L"C:\\Windows", false ) ) 
        std::wcout << path << '\n' ;
}

http://rextester.com/MVQND35610

commented: Very Nice +13
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.