Hello. I have this code:
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
void _tmain(int argc, TCHAR *argv[])
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
printf ("Target file is %s.\n", argv[1]);
hFind = FindFirstFile(argv[1], &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("FindFirstFile failed (%d)\n", GetLastError());
system("pause");
return;
}
else
{
do
{
printf("%s\n",FindFileData.cFileName);
}
while (FindNextFile(hFind,&FindFileData)!=0);
FindClose(hFind);
}
system("pause");
FindClose(hFind);
}
I need to get a folder list in output, but it gives me the following:
.
.
f
f
f
Actually, my folder listing is:
.
..
file1
file2
file3
Why do i have only first letter of file name? Thanks.