0
すべてのファイル名を配列に取得しようとしています。しかし、すべてのファイル名を読み込んだあと、配列には最後のファイル名しかありません。配列にファイル名を格納するVC++
#include <Windows.h>
#include <strsafe.h>
#include <iostream>
int main() {
WIN32_FIND_DATA ffd;
HANDLE handle = INVALID_HANDLE_VALUE;
TCHAR *directory = L"D:/*.*";
LPCWSTR filenames[30] ;
handle = FindFirstFile(directory, &ffd);
int count = 0;
if (handle != INVALID_HANDLE_VALUE) {
OutputDebugString(ffd.cFileName);
do {
filenames[count++] = ffd.cFileName;
OutputDebugString(filenames[count -1]);
} while (FindNextFile(handle, &ffd) != 0);
}
else {
OutputDebugString(L"Nothing to display \n");
}
for (int i = 0; i < 10; i++) {
OutputDebugString(filenames[i]);
}
FindClose(handle);
getchar();
return 0;
}
私はこのコードを持っている問題は何..です事前に 感謝..以上