Hi,
I wrote a simple on-file directory lister. It works, but I have to press Ignore in a block damage error messagebox everytime I tun it. Any idea? Thanks in advance.
#include <windows.h>
#include <iostream>
#include <string.h>
#include <string>
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main()
{
HANDLE hFind;
WIN32_FIND_DATA FindData;
char * curWorkDir=new char[MAX_PATH];
if( (curWorkDir = _getcwd( NULL, 0 )) == NULL )
perror( "_getcwd error" );
FILE * out = fopen("ListFile.txt", "w");
sprintf(curWorkDir,"%s\\*.*",curWorkDir);
cout<<curWorkDir<<endl;
hFind = FindFirstFile(curWorkDir, &FindData);
fprintf(out, FindData.cFileName);
while (FindNextFile(hFind, &FindData))
{
fprintf(out, FindData.cFileName);
fputc('\n', out);
}
FindClose(hFind);
fclose(out);
delete curWorkDir;
cout<<"ListFile generated\n";
return 0;
}