Hey guys, I've been trying for way too long just to get this program to print the name of a directory from the command line and the first file name. I always just get a whole bunch of question marks and random characters.This is my first time working with tprintf and TCHAR and stuff, so I really don't know where it's going wrong.
That's because argv[0] is the path and name of your application, it's not the first argument from the command line...
EDIT: Also, keep in mind that the very first file returned from this function if you pass it "*.*", which you should be doing if you want to see any and all of the files there, will be a single dot.
You also don't need to use tprintf, "WIN32_FIND_DATA.cFileName[]" is a TCHAR array which is a typecast of char. This will work fine with std::cout << ....
I switched argv[0] with argv[1] and used cout, now I get what appears to be a hex number instead of the question marks. With the first file as well, it prints a weird hex number and the file size is a huge negative number :S.
Are you sure you're getting anything at all? Test your "finder" variable to see if it is equal to "INVALID_HANDLE_DATA" which is an enumeration, not a literal string. if true then