 |

|
I am utilizing the current version on this class and it works great for my application.
Is there a version of this that can be used in a win32 console application or a win32 application?
It's work like yours that makes using and learning how to program so much more easy. It just makes life much easier than trying to re-invent the wheel! Thanks for the code and hope you can help with my Console or win32 application!
Thanks,
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0 Visual Studio 2005
|
|
|
|

|
there's no reason this can't work in a console app, provided that app uses MFC. for a Win32 app, or if you're not using MFC, you'll need to replace things like CString with the std:: equivalents.
|
|
|
|

|
Wow thanks for the super fast response! Don't suppose you could point to some code that would get me started? Anyway thanks for the info!
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0 Visual Studio 2005
|
|
|
|

|
hey Chris,
I need to use your classes with my USB Automatic File Syncing Application (with a remote host).
I am having difficulties in reading the source directory in the USB drive with those functions provided along with a FTP client library I am using as FTPWebRequest object need path starting with "/" which is a norm for specifying source directory in FTPs.
I really feel your application can help me...so that I can monitor my USB drive contents and populate the Lists with file and directory names in it.
And later on I just need to set the Upload filenames to Upload my files on the server.
I am working on C#.NET so can you provide me the source of your application in C# or any significant guidance would be highly appreciable.
NITIN
|
|
|
|

|
Hi, it appears that VC8 does not like your code. When I tried to build, I got all sorts of errors. I’m sorry for barrage below, but it doesn’t seem I can attach the log as a file.
Build Log
Build started: Project: HDSearcher, Configuration: Debug|Win32
Command Lines
Creating temporary file "k:\My Documents\HomeDirectories Project\HDSearcher\HDSearcher\Debug\RSP00000411084876.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Wp64 /ZI /TP ".\Main.cpp"
".\SADirRead.cpp"
]
Creating command line "cl.exe @"k:\My Documents\HomeDirectories Project\HDSearcher\HDSearcher\Debug\RSP00000411084876.rsp" /nologo /errorReport:prompt"
Output Window
Compiling...
SADirRead.cpp
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(127) : error C2059: syntax error : ''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(127) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(131) : error C2146: syntax error : missing ';' before identifier 'm_sName'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(131) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(131) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(144) : error C2146: syntax error : missing ';' before identifier 'm_sName'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(144) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(144) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(174) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(174) : error C2143: syntax error : missing ',' before '&'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C2146: syntax error : missing ';' before identifier 'FindFiles'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C2143: syntax error : missing ',' before '&'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : warning C4183: 'FindFiles': missing return type; assumed to be a member function returning 'int'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(176) : error C2061: syntax error : identifier 'CString'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(178) : error C2146: syntax error : missing ';' before identifier 'm_sSourceDir'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(128) : error C2065: 'm_sSourceDir' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(146) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(146) : error C2143: syntax error : missing ',' before '&'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(148) : error C2146: syntax error : missing ';' before identifier 'newPath'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(148) : error C2065: 'newPath' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(150) : error C2146: syntax error : missing ';' before identifier 'searchString'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(150) : error C2065: 'searchString' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(151) : error C2065: 'path' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(199) : error C2065: 'WIN32_FIND_DATA' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(199) : error C2146: syntax error : missing ';' before identifier 'FindFileData'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(199) : error C2065: 'FindFileData' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(200) : error C2065: 'HANDLE' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(200) : error C2146: syntax error : missing ';' before identifier 'hFind'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(200) : error C2065: 'hFind' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(201) : error C2065: 'INVALID_HANDLE_VALUE' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(201) : error C3861: 'FindFirstFile': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(204) : error C2228: left of '.dwFileAttributes' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(204) : error C2065: 'FILE_ATTRIBUTE_DIRECTORY' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(207) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(207) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(211) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(219) : error C3861: 'FindNextFile': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(222) : error C2228: left of '.dwFileAttributes' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(225) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(225) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(229) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(238) : error C3861: 'FindClose': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(272) : error C2065: 'CString' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(272) : error C2146: syntax error : missing ';' before identifier 'curDir'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(272) : error C2065: 'curDir' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(272) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSADirEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(125) : see declaration of 'CSADirRead::CSADirEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(275) : error C2228: left of '.IsEmpty' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(315) : error C2448: 'CSADirRead::FormatPath' : function-style initializer appears to be a function definition
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(339) : error C2143: syntax error : missing ';' before 'CSADirRead::FindFiles'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(339) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(339) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(339) : error C2143: syntax error : missing ',' before '&'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(340) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(342) : error C2146: syntax error : missing ';' before identifier 'baseName'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(342) : error C2065: 'baseName' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(342) : error C2065: 'dir' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(346) : error C2146: syntax error : missing ';' before identifier 'fullPath'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(346) : error C2065: 'fullPath' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(347) : error C2065: 'filter' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(349) : error C2146: syntax error : missing ';' before identifier 'fileName'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(349) : error C2065: 'fileName' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(420) : error C2146: syntax error : missing ';' before identifier 'FindFileData'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(421) : error C2146: syntax error : missing ';' before identifier 'hFind'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(424) : error C3861: 'FindFirstFile': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(426) : error C2228: left of '.dwFileAttributes' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(428) : error C2065: 'bIncludeFoldersInFileList' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(428) : error C2065: 'bIncludeFilesInFileList' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(431) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(431) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(439) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(442) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(143) : see declaration of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(445) : error C2228: left of '.dwFileAttributes' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(447) : error C2228: left of '.ftLastWriteTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(447) : error C2065: '_FILETIME' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(447) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(447) : error C3861: 'ASSERT': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(448) : error C2228: left of '.ftLastWriteTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(448) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(450) : error C2228: left of '.ftLastWriteTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(450) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(450) : error C3861: 'ASSERT': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(451) : error C2228: left of '.ftCreationTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(451) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(453) : error C2228: left of '.nFileSizeHigh' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(453) : error C2065: 'MAXDWORD' : undeclared identifier
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(453) : error C2228: left of '.nFileSizeLow' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(458) : error C3861: 'FindNextFile': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(460) : error C2228: left of '.dwFileAttributes' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(465) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(465) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(473) : error C2228: left of '.cFileName' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(476) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(143) : see declaration of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(479) : error C2228: left of '.dwFileAttributes' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(481) : error C2228: left of '.ftLastWriteTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(481) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(481) : error C3861: 'ASSERT': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(482) : error C2228: left of '.ftLastWriteTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(482) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(484) : error C2228: left of '.ftLastWriteTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(484) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(484) : error C3861: 'ASSERT': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(485) : error C2228: left of '.ftCreationTime' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(485) : error C2070: ''unknown-type'': illegal sizeof operand
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(487) : error C2228: left of '.nFileSizeHigh' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(487) : error C2228: left of '.nFileSizeLow' must have class/struct/union
type is ''unknown-type''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(491) : error C3861: 'FindClose': identifier not found
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(507) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSADirEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(125) : see declaration of 'CSADirRead::CSADirEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(507) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSADirEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(125) : see declaration of 'CSADirRead::CSADirEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(514) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(143) : see declaration of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.cpp(514) : error C2039: 'm_sName' : is not a member of 'CSADirRead::CSAFileEntry'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(143) : see declaration of 'CSADirRead::CSAFileEntry'
Main.cpp
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(127) : error C2059: syntax error : ''
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(127) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(131) : error C2146: syntax error : missing ';' before identifier 'm_sName'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(131) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(131) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(144) : error C2146: syntax error : missing ';' before identifier 'm_sName'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(144) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(144) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(174) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(174) : error C2143: syntax error : missing ',' before '&'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C2146: syntax error : missing ';' before identifier 'FindFiles'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C2143: syntax error : missing ',' before '&'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(175) : warning C4183: 'FindFiles': missing return type; assumed to be a member function returning 'int'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(176) : error C2061: syntax error : identifier 'CString'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(178) : error C2146: syntax error : missing ';' before identifier 'm_sSourceDir'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\sadirread.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
k:\my documents\homedirectories project\hdsearcher\hdsearcher\main.cpp(7) : error C2059: syntax error : '...'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\main.cpp(8) : error C2143: syntax error : missing ';' before '{'
k:\my documents\homedirectories project\hdsearcher\hdsearcher\main.cpp(8) : error C2447: '{' : missing function header (old-style formal list?)
k:\my documents\homedirectories project\hdsearcher\hdsearcher\main.cpp(29) : fatal error C1004: unexpected end-of-file found
Generating Code...
Results
Build log was saved at "file://k:\My Documents\HomeDirectories Project\HDSearcher\HDSearcher\Debug\BuildLog.htm"
HDSearcher - 137 error(s), 2 warning(s)
I am new to coding, so this could easily be all my fault, but if it is, can you help me fix it?
|
|
|
|

|
it looks like the compiler is missing all the standard Windows and MFC types.
are you putting this in an MFC app ? (you need to)
|
|
|
|

|
I’m using Visual C++ 2005 Express Edition with Service Pack 1. (This is the first program/script I’ve need to do since coming here and they don’t have a copy of Visual Studio for me to use.) The place I work for wanted me to write a script to look though our user directory tree and created an entry for each second-level folder. Your code looked like perfect match. I did some coding in C++ back in college, but it’s been a while and at that point we wrote all of the code ourselves and the programs were very simple. I looked for a project type that contained MFC in the name, but I could not find one. The project type the errors were generated in was a Win32 Console Application. Should I be using a different project type?
|
|
|
|

|
ah. MFC isn't included with VS05 Express.
but, the basics of directory spanning are pretty simple: take a look at the MSDN for the FindFirstFile and FindNextFile functions. those functions (or their equivalents) are at the heart of my class.
|
|
|
|

|
HI chris,
thnx for such a gr8 class. well i hav to use it in a simple win32 application without any MFC. The system(win2k,9x,XP), where my application will be deployed, doesnt hav any MFC dll installed. As ur class uses CString which is MFC class, will it work in my scenario. plz help me in this regard.
hye plz reply soon as possible...
thnx
|
|
|
|

|
you could try replacing CString with something like this class^.
|
|
|
|

|
thnx chris, i hav to check the incompatibilities of CString n this new class, but it seems there r not many...
|
|
|
|

|
Hi, I downloaded the code and it is working fine. When I integrated it into my program, i got this error. (I have copied, SADirRead.cpp and the .h) filelistDlg.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CSADirRead::~CSADirRead(void)" (??1CSADirRead@@UAE@XZ) filelistDlg.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CSADirRead::ClearFiles(void)" (?ClearFiles@CSADirRead@@QAE_NXZ) filelistDlg.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CSADirRead::SortFiles(int,bool)" (?SortFiles@CSADirRead@@QAE_NH_N@Z) filelistDlg.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CSADirRead::GetFiles(char const *,bool,bool)" (?GetFiles@CSADirRead@@QAE_NPBD_N1@Z) filelistDlg.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CSADirRead::GetDirs(char const *,bool)" (?GetDirs@CSADirRead@@QAE_NPBD_N@Z)
Basically it is telling this "<return type>__thiscall CSADirRead::<function prototype>" (?<function name@CSADirRead@@<some characters>)
Please help me. Thank you Mukund
|
|
|
|
|

|
Yes I did. these were those files SADirRead.cpp SADirRead.h Mukund
|
|
|
|
|

|
How to resolve with this problem?
I'm using vietnammese file name, and this program has not true unicode file name!
|
|
|
|

|
I don't know where you found %u64 S/B %lu
Old dog learning new tricks!
|
|
|
|

|
when i get the file path by (*fit).m_sName, the path is fullpath
is possible to get the relative path ?
for example, if the current directory of the process is c:\temp which contain a sub directory c:\temp\subtemp
i found i can pass the relative path like this:
dr.GetDirs("subtemp", true);
but the filepath from (*fit).m_sName is like
"c:\temp\subtemp\a.txt"
and i just want "subtemp\a.txt"
how can i get this result ?
thx
|
|
|
|

|
you'll have to figure out the relative path yourself. but, it's a fairly simple string parsing process. something like this:
To: c:\foo\file.txt
From: c:\foo\subdir\file2.txt
remove the parts of the path that match:
To: \file.txt
From: \subdir\file2.txt
then, for each folder name in From, add ".." to the start of To:
..\file.txt
Cleek | Losinger Designs | ClickPic | ThumbNailer
|
|
|
|

|
Hi, thanks for the cool code mate, I can't seem to get it to work in mine though. Here are the compiler errors I get Compiling... main.cpp C:\Matthew_W\SADirRead.h(127) : error C2629: unexpected 'struct CSADirRead::CSADirEntry (' C:\Matthew_W\SADirRead.h(127) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body C:\Matthew_W\SADirRead.h(131) : error C2146: syntax error : missing ';' before identifier 'm_sName' C:\Matthew_W\SADirRead.h(131) : error C2501: 'CString' : missing storage-class or type specifiers C:\Matthew_W\SADirRead.h(131) : error C2501: 'm_sName' : missing storage-class or type specifiers C:\Matthew_W\SADirRead.h(144) : error C2146: syntax error : missing ';' before identifier 'm_sName' C:\Matthew_W\SADirRead.h(144) : error C2501: 'CString' : missing storage-class or type specifiers C:\Matthew_W\SADirRead.h(144) : error C2501: 'm_sName' : missing storage-class or type specifiers C:\Matthew_W\SADirRead.h(174) : error C2143: syntax error : missing ',' before '&' C:\Matthew_W\SADirRead.h(174) : error C2059: syntax error : '&' C:\Matthew_W\SADirRead.h(175) : error C2146: syntax error : missing ';' before identifier 'FindFiles' C:\Matthew_W\SADirRead.h(175) : error C2501: 'UINT' : missing storage-class or type specifiers C:\Matthew_W\SADirRead.h(175) : error C2143: syntax error : missing ',' before '&' C:\Matthew_W\SADirRead.h(175) : error C2059: syntax error : '&' C:\Matthew_W\SADirRead.h(176) : error C2061: syntax error : identifier 'CString' C:\Matthew_W\SADirRead.h(178) : error C2146: syntax error : missing ';' before identifier 'm_sSourceDir' C:\Matthew_W\SADirRead.h(178) : error C2501: 'CString' : missing storage-class or type specifiers C:\Matthew_W\SADirRead.h(178) : error C2501: 'm_sSourceDir' : missing storage-class or type specifiers C:\Matthew_W\main.cpp(113) : error C2039: 'm_sName' : is not a member of 'CSAFileEntry' C:\Matthew_W\SADirRead.h(143) : see declaration of 'CSAFileEntry' Error executing cl.exe. Creating browse info file... hrugen.exe - 19 error(s), 0 warning(s)
|
|
|
|

|
I think I've narrowed it down to my program not being an mfc type program (feel free to correct me if I'm way off track here). Any way I can use this code in a non-mfc program...I'll keep rying
|
|
|
|

|
I have yhe same probleme
I hope, if you result the pb, sent it to forum
|
|
|
|

|
Hi,
i have got problems with the SADirRead Class. Which files from the example do i need ? Which Changes have to be done by me in the rest of the project ?
When i tryed to integrate the class i often got the error message:
SADirRead.h(127) : error C2226: Syntaxerror: Typ 'CSADirRead::CSADirEntry' not expected
I would be glad to get some advise.
Stephan
|
|
|
|
|

|
First i have not - but it did not compile... which files do i need to include ? First i took SADirRead.h and SADirRead.cpp but in the SADirRead.cpp file dir.h is also included... I have only the example files - perhaps there is also a possiblility to get only the sources which are different ?!?
|
|
|
|

|
To be understood right: The Examlple compiled without problems but in my own project i´ve got the problems...
|
|
|
|
|

|
Ok got it - but i got these cast Problems:
SADirRead\SADirRead.cpp(509) : error C2664: 'stricmp': Konvertierung des Parameters 1 von 'const CString' in 'const char *' nicht möglich
in Eng:
SADirRead\SADirRead.cpp(509) : error C2664: 'stricmp': Conversion of Parameter 1 from 'const CString' in 'const char *' not possible
any idea on this ?
Thanks a lot anyway
|
|
|
|

|
which compiler are you using? what kind of project are you using this in (MFC app, console app, dialog app?)
i can't duplicate this with vc6 or vc7.
ClickPic | ImgSource | CheeseWeasle
|
|
|
|

|
I use vc7 and a dialog app
|
|
|
|

|
Hello,
I am trying to get access to a folder and get a list of its files in MFC. Is there any class that I can use like CFolder or something. Thank you.
vg
|
|
|
|

|
Hi. I noticed that the filedates are off by 6 hours (they are 6 hours to far ahead). Is this a time zone thing? Is there any simple way to adjust for this, to account for whatever timezone the user is in?
Thanks!
-Jeff
|
|
|
|

|
Hi!! Nice to meet you? I am new to file, please teach me something. Thank You
Can anyone tell me how this program start searching from the C:\\? How it work actually? Is this cause by WIN32_FIND_DATA?
WIN32_FIND_DATA FindFileData; I saw this statement in this example, what is inside variable FindFileData?
FindFileData.cFileName; Is that a filename? I din't tell anything, is that automatic called?
|
|
|
|

|
to search fromn C:\\, do this:
CSADirRead dr;
dr.GetDirs("c:\\", false);
dr.GetFiles("*.*", false, true);
|
|
|
|

|
Hi , I don't think many people NEED this , BUT I NEED IT URGENTLY,
Please any one know how to get the file name from a file handle !
Thanks
|
|
|
|

|
Hi, folks...
I have a design which requires maintaining several .ini files, both local to the app and on a server for global settings. I'm using SHBrowseForFolder in a dialog to build a path to my global files, which then needs to be saved in the local file. I use a relative filename for my local file, so that I can always find it regardless of where my executable is launched from. However, when I use the folder browser, the local filename gets appended to the path returned by the folder browsing activity and the local file gets written relative to the global path.
How can I determine the path within which my application has been executed from, so that I can easily get to its local .ini file?
Thanks! Jesse
|
|
|
|
|

|
Bingo!
Thanks, Chris. From your suggestion and a search through MSDN, I came up with the following, which solves the problem quite nicely:
CString CApp::MakeLocalPath (CString FileName)
{
bool bOk = false;
TCHAR szAppName[MAX_PATH];
TCHAR szDrive[64];
TCHAR szDir[MAX_PATH];
TCHAR szNewName[MAX_PATH];
bOk = (0 != GetModuleFileName(NULL, szAppName, MAX_PATH));
if (bOk)
{
_tsplitpath(szAppName, szDrive, szDir, NULL, NULL);
_makepath (szNewName, szDrive, szDir, FileName, NULL);
}
return szNewName;
}
BTW, I love this site! I've been writing software for more than 20 years but only recently using C++/MFC. This site has been a great resource for learning real-world coding for this framework. Keep up the good work!
'til next we type...
HAVE FUN!! -- Jese
|
|
|
|

|
How can i use this class to find files longer than 179?
thx
|
|
|
|

|
sorry, the problem's not in your class.
thanks again
|
|
|
|

|
How did you solve this?
What limits the files list to 179 chars?
---
www.funvill.com
|
|
|
|

|
Chris,
I added your code, but can't get it to run. It did at one time run, but I don't know what has changed.
Any ideas?????
Here is the code:
UpdateData(TRUE);
CString m_path = _T("c:\\temp");
CString m_filter = _T("*.txt");
// this object will find and hold out list of files and folders
CSADirRead dr;
// look in subfolders ?
dr.Recurse() = true;
// get sub folders in this folder
dr.GetDirs(m_path);
/*
we could add more dirs to the list by doing this:
dr.GetDirs("d:\\folder\\");
*/
// dump the current directory list
CSADirRead::SADirVector &dirs = dr.Dirs();
TRACE("Dirs\n");
for (CSADirRead::SADirVector::const_iterator dit = dirs.begin(); dit!=dirs.end(); dit++)
{
TRACE("%s\n", (*dit).m_sName);
}
// dr has a list of dirs. find all files in those dirs that match the file filter
dr.GetFiles(m_filter);
// now dr has a list of files
// dump them
CSADirRead::SAFileVector &files = dr.Files();
TRACE("Pre-sort\n.%s Files in %s\n", m_filter, m_path);
for (CSADirRead::SAFileVector::const_iterator fit = files.begin(); fit!=files.end(); fit++)
{
TRACE("%s: %d bytes\n", (*fit).m_sName, (*fit).size);
}
/*
we could get more files here, by doing more "GetFiles" calls, like this:
dr.GetFiles("c*.txt");
*/
// dump them
TRACE("\nPost-sort\n. %s Files, sorted\n", m_filter);
for (fit = files.begin(); fit!=files.end(); fit++)
{
// CTime has ctors for both _FILETIME and time_t. yay.
CTime accessTime((*fit).time_access);
CTime createTime((*fit).time_create);
CTime writeTime((*fit).time_write);
TRACE("%s:\t\t\t%I64u bytes.\t\tAccess time: %s\t\tCreate time: %st\tWrite time: %s)\n",
(*fit).m_sName,
(*fit).size,
accessTime.Format("%b %d, %Y, %H:%M:%S"),
createTime.Format("%b %d, %Y, %H:%M:%S"),
writeTime.Format("%b %d, %Y, %H:%M:%S"));
}
|
|
|
|

|
jimNLX wrote:
Any ideas?
where does the AV happen??
-c
"Half of the harm that is done in this world is due to people who want to feel important."
-- TS Elliot |
|
|
|

|
it happens on the TRACE for the file names.
|
|
|
|

|
i'm not sure.
if i paste your code into the demo app, it runs fine for me.
-c
"Half of the harm that is done in this world is due to people who want to feel important."
-- TS Elliot |
|
|
|

|
I'm using your class is a little project of mine.
your earlier version worked fine when I compiled
CString m_OrgFilename;
CSADirRead::SAFileVector::iterator m_Fit1;
CSADirRead::SAFileVector &files = m_dr.Files();
...
m_Fit1 = find(files.begin(), files.end(), m_OrgFilename);
However, when I used your new (Jan 2002) version, the compiler didn't like the find() algorithm.
After digging through your code, I discovered that you had removed the == operator from your struct CSAFileEntry.
replacing this works.
The question is, why was it removed? Is there a better way to do the find, or can I just leave it where it is?
Paresh Solanki
21 Again
IMHO..."The fact that an opinion has been widely held is no evidence that it is not utterly absurd."
Bertrand Russell (1872-1970) - British philosopher
|
|
|
|

|
i don't remember why it was removed. but, i know it compiled fine for me without it (or i wouldn't have posted the code). but, it's probably fine to leave it in.
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|

|
Actually, I probably wasn't clear enough.
your source compiled fine, my code using the find() algorithm complained because there was no conversion for the '==' operator.
anyhow, thanks for the article, it's saved me a lot of time
Paresh Solanki
21 Again
IMHO..."The fact that an opinion has been widely held is no evidence that it is not utterly absurd."
Bertrand Russell (1872-1970) - British philosopher
|
|
|
|
|

|
i guess you could do it like this:
if the text in the text box is a folder, scan that folder to get a list of files.
if the text is not a folder, fill the dropdown list with the list of files.
repeat
-c
Smaller Animals Software, Inc.
|
|
|
|
 |