get_files does not use std but char string.
I'm pleasure if you download the below.
https://github.com/WaitrudWeber/source_zip/blob/master/directory_20190327.zip
Please reffer to the below for compilation.
https://waitrudweber.hatenablog.com/entry/2018/05/01/005938
> .\print_003.exe .\*.cpp
print_char: .\*.cpp
get_files: start: .\aDebug.cpp : .\*.cpp
skip away : .
skip away : ..
skip away : .
skip away : ..
skip away : .
skip away : ..
skip away : .
skip away : ..
get_files: end
list_dummy_ary[0]=.\aDebug.cpp
list_dummy_ary[1]=.\array_counter.cpp
list_dummy_ary[2]=.\array_counter.cpp-001
list_dummy_ary[3]=.\list_directory.cpp
list_dummy_ary[4]=.\main_000.cpp
list_dummy_ary[5]=.\parse.cpp
list_dummy_ary[6]=.\php_analyzer.cpp
list_dummy_ary[7]=.\php_parse.cpp
list_dummy_ary[8]=.\php_struct.cpp
list_dummy_ary[9]=.\Print.cpp
list_dummy_ary[10]=.\print_001.cpp
list_dummy_ary[11]=.\print_002.cpp
list_dummy_ary[12]=.\print_003.cpp
list_dummy_ary[13]=.\sender.cpp
numnrt: 14
| 0|.\aDebug.cpp|
| 1|.\array_counter.cpp|
| 2|.\array_counter.cpp-001|
| 3|.\list_directory.cpp|
| 4|.\main_000.cpp|
| 5|.\parse.cpp|
| 6|.\php_analyzer.cpp|
| 7|.\php_parse.cpp|
| 8|.\php_struct.cpp|
| 9|.\Print.cpp|
| 10|.\print_001.cpp|
| 11|.\print_002.cpp|
| 12|.\print_003.cpp|
| 13|.\sender.cpp|
28 :// it refers all to 29 :// https://stackoverflow.com/questions/11362771/list-files-in-directory-c 30 :// https://bituse.info/winapi/31 31 :// 32 :// Parameters 33 :// 34 :// lpcstr_path 35 :// 36 :// Directory name which is going to be found files. 37 :// 38 :// Return Value 39 :// 40 :// char** 41 :// 42 :// File list under the lpcstr_path, which has fullpath. 43 :// 44 :char** FileControler::get_files ( char* lpcstr_path, int* file_num ) { 45 : WIN32_FIND_DATA ffd; 46 : HANDLE hFind = INVALID_HANDLE_VALUE; 47 : char* ffdc_filename; 48 : int dummy_filenum = 0; 49 : char* char_asterisk_path = (char*)"\0"; // .\abc\* if .\abc\*.php 50 : char* char_attr = (char*)"\0"; 51 : int cnt = 0; 52 : int cnt_char_asterisk_path = 0; 53 : 54 : // Prepare string for use with FindFile functions. First, copy the 55 : // string to a buffer, then append '\*' to the directory name. 56 : cnt = array_count(lpcstr_path); 57 : int search_length = m_last_with( lpcstr_path, (char*)"."); 58 : if ( search_length <= 0 ) { 59 : 60 : hFind = FindFirstFile( TEXT( lpcstr_path ), &ffd ); 61 : char_asterisk_path = lpcstr_path; 62 : } else { 63 : 64 : // In this case, lpcstr_path is like ".\abc\*.php" 65 : char_asterisk_path = substring( lpcstr_path, 0, search_length ); 66 : cnt_char_asterisk_path = array_count( char_asterisk_path ); 67 : char_attr = substring( lpcstr_path, search_length, cnt - cnt_char_asterisk_path ); // max_count:cnt 68 : hFind = FindFirstFile( TEXT( char_asterisk_path ), &ffd ); 69 : } 70 : 71 : ffdc_filename = copyof( (char*)ffd.cFileName ); 72 : int index = 0; 73 : // List all the files in the directory with some info about them. 74 : do 75 : { 76 : ffdc_filename = copyof( (char*)ffd.cFileName ); 77 : index++; 78 : char* char_directory = to_directory ( char_asterisk_path, ffdc_filename ); 79 : 80 : if ( char_directory == NULL || m_compare( ffdc_filename, (char*)".") == 1 || m_compare( ffdc_filename, (char*)"..") == 1 ) { 81 : 82 : printf ( "skip away : %s\r\n", ffdc_filename ); 83 : 84 : } else { 85 : 86 : if ( is_attribute ( ffdc_filename, char_attr ) == 1 ) { 87 : this->put_string ( char_directory ); 88 : } 89 : 90 : if ( ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) { 91 : char* listfiles = (char*) m_concat( (char*)char_directory, (char*)"\\*" ); 92 : listfiles = (char*) m_concat( (char*)listfiles, (char*)char_attr ); 93 : this->get_files( (char*) listfiles, &dummy_filenum ); 94 : } 95 : 96 : } 97 : } 98 : while ( FindNextFile(hFind, &ffd ) != 0); 99 : 100 : FindClose(hFind); 101 : *file_num = this->get_strings_number () ; 102 : 103 : return get_strings(); 104 :}