Where is stdafx.h? Before or after #include <string>?
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Remember also that most of STL was utter c**p in VC++6. std::string might work (maybe) but many other parts of STL either weren't supported or just didn't work.
Do upgrade your compiler. If you're short of cash you can usually obtain VC++8 (Visual Studio 2005) at very reasonable prices and it's soooo much better than VC++6 in every way.
"A problem well stated is a problem half solved.” - Charles F. Kettering
Not for "some stupid reasons" but for testing purpose, I still use sometimes Visual C++ 6.0 (Enterprise Edition, SP5) and have no problem.
I've attached here a little test application using std::string and other STL stuff.
Just try to compile it yourself. If no success, then it's a mistake in your program or VC6 is not properly installed.
Last edited by ovidiucucu; February 21st, 2012 at 09:46 AM.
when I did
findData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY
for the path string defaultTempPath = "c:\\Documents and Settings\\"+userName+"\\Local Settings\\Temporary Internet Files\\Content.IE5";
all the directories inside the Content.IE5 folder is not recognized as folder by findData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY , it gives 0 (false) as output
Im wring a code to search if my website has been downloaded by IE or not, this is done by searching a file recursive inside "c:\\Documents and Settings\\"+userName+"\\Local Settings\\Temporary Internet Files\\Content.IE5";
I wanted to make it recursive search for a file name (abc.jpg) , i wrote this code (based on ovidiucucu's code), but its seems to be not working .
std::string::compare returns 0 if the strings are equal, so here is a possible mistake:
Code:
if ( fileName.compare("accountmsg"))
don't trust in environment variables; they may differ or may be missing in diffrent systems.
do not use hard-coded special folders like "c:\\Documents and Settings..."; they may differ in differnt languages and in different Windows versions.
Instead, call SHGetSpecialFolderPath or SHGetFolderPath.
last but not the least: in your code, no file name is added to the list; of course there is "no desired output as well"...
All these being said, if you want to get a list of files having ".jpg" extension from "Content.IE5" subfolder of temporary Internet files folder, you have to write something like this:
I face this problem when compiled:-
C:\project\web\test\Test_std_VS6.cpp(53) : error C2039: 'SHGetSpecialFolderPath' : is not a member of '`global namespace''
C:\project\web\test\Test_std_VS6.cpp(53) : error C2065: 'SHGetSpecialFolderPath' : undeclared identifier
C:\project\web\test\Test_std_VS6.cpp(53) : error C2065: 'CSIDL_INTERNET_CACHE' : undeclared identifier
Just take a look with a little bit more attention in my example and see this note:
Originally Posted by ovidiucucu
Code:
#include "stdafx.h"
// NOTE: <windows.h> and <shlobj.h> included in stdafx.h
Also, you may have a look in SHGetSpecialFolderPath function documentation, focus on "Requirements" section and see which header file must be included.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.