Click here to Skip to main content
15,898,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How do I read the contents of a directory? Pin
David Crow24-Feb-09 3:17
David Crow24-Feb-09 3:17 
GeneralRe: How do I read the contents of a directory? Pin
Megidolaon24-Feb-09 20:30
Megidolaon24-Feb-09 20:30 
GeneralRe: How do I read the contents of a directory? Pin
David Crow25-Feb-09 3:16
David Crow25-Feb-09 3:16 
GeneralRe: How do I read the contents of a directory? Pin
Megidolaon25-Feb-09 21:31
Megidolaon25-Feb-09 21:31 
GeneralRe: How do I read the contents of a directory? Pin
David Crow26-Feb-09 2:43
David Crow26-Feb-09 2:43 
GeneralRe: How do I read the contents of a directory? Pin
Megidolaon27-Feb-09 0:20
Megidolaon27-Feb-09 0:20 
QuestionRe: How do I read the contents of a directory? Pin
David Crow27-Feb-09 3:15
David Crow27-Feb-09 3:15 
AnswerRe: How do I read the contents of a directory? [modified] Pin
Megidolaon1-Mar-09 20:36
Megidolaon1-Mar-09 20:36 
vector<wstring> files;
	WIN32_FIND_DATA findData;
	BOOL bFound = TRUE;
	 
	HANDLE handle = FindFirstFile(L"C:\Dokumente und Einstellungen\Student\Eigene Dateien", &findData);		   
	if (handle != INVALID_HANDLE_VALUE)
	{
		while (bFound)
		{
			files.push_back(findData.cFileName);
			bFound = FindNextFile(handle, &findData);      
		}	   
	}
	 
	for (int k = 0; k < files.size(); k++)   
	{
		cout << "Reading File:" << files[k].c_str() << endl;   
	}

getchar();</wstring>
I copied your code and used wstring, then added an L to the filepath, as you said.
I used getchar(), to keep the console open.
I made a break point at the line of files.push_back(findData.cFileName);, but the program never reaches that line.
It simply does nothing, probably because when I put a breakpoint at the FindFirstFile line and then go the next line with F11, I get an error telling me that for the current position no source code is avaiable.

modified on Monday, March 2, 2009 5:23 AM

GeneralRe: How do I read the contents of a directory? Pin
David Crow2-Mar-09 2:27
David Crow2-Mar-09 2:27 
GeneralRe: How do I read the contents of a directory? Pin
Megidolaon2-Mar-09 3:07
Megidolaon2-Mar-09 3:07 
GeneralRe: How do I read the contents of a directory? Pin
David Crow2-Mar-09 3:14
David Crow2-Mar-09 3:14 
GeneralRe: How do I read the contents of a directory? Pin
Megidolaon2-Mar-09 20:21
Megidolaon2-Mar-09 20:21 
QuestionRe: How do I read the contents of a directory? Pin
David Crow3-Mar-09 2:51
David Crow3-Mar-09 2:51 
AnswerRe: How do I read the contents of a directory? Pin
Megidolaon5-Mar-09 21:06
Megidolaon5-Mar-09 21:06 
QuestionRe: How do I read the contents of a directory? Pin
David Crow6-Mar-09 2:17
David Crow6-Mar-09 2:17 
AnswerRe: How do I read the contents of a directory? Pin
Megidolaon8-Mar-09 21:44
Megidolaon8-Mar-09 21:44 
GeneralRe: How do I read the contents of a directory? Pin
David Crow9-Mar-09 3:39
David Crow9-Mar-09 3:39 
GeneralRe: How do I read the contents of a directory? Pin
Megidolaon10-Mar-09 1:51
Megidolaon10-Mar-09 1:51 
QuestionRe: How do I read the contents of a directory? Pin
David Crow10-Mar-09 3:15
David Crow10-Mar-09 3:15 
AnswerRe: How do I read the contents of a directory? Pin
Megidolaon11-Mar-09 0:35
Megidolaon11-Mar-09 0:35 
QuestionRe: How do I read the contents of a directory? Pin
David Crow11-Mar-09 2:32
David Crow11-Mar-09 2:32 
AnswerRe: How do I read the contents of a directory? Pin
Megidolaon12-Mar-09 21:44
Megidolaon12-Mar-09 21:44 
QuestionRe: How do I read the contents of a directory? Pin
David Crow13-Mar-09 2:58
David Crow13-Mar-09 2:58 
AnswerRe: How do I read the contents of a directory? Pin
Megidolaon15-Mar-09 21:19
Megidolaon15-Mar-09 21:19 
QuestionCStatic on CMDIChildWnd Pin
prithaa23-Feb-09 22:30
prithaa23-Feb-09 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.