#if defined (_UNICODE) || defined (UNICODE)
#error "Unicode not supported - use Multi-Byte Character Set"
#endif
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <sstream>
usingnamespace std;
string n;
string f1;
string flf;
string f2;
stringstream ss;
stringstream rr;
int main (void)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
flf = "*.*";
cout<<"Enter file's location: "<<endl;
cin >> f1;
rr = f1+flf;
constchar szInitialDir[] = (rr.str().c_str());
printf ("Initial directory: %s", szInitialDir);
hFind = FindFirstFileA (szInitialDir, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("Error: %lu ", GetLastError ());
system ("pause");
return EXIT_FAILURE;
}
do
{
printf ("\nFile: %s", FindFileData.cFileName);
} while (FindNextFileA (hFind, &FindFileData));
FindClose (hFind);
system ("pause");
cout<<"Witch you want to run?"<<endl;
cin >> n;
ss << "start " << f1 << n;
system (ss.str().c_str());
//the end
return 0;
return EXIT_SUCCESS;
}
error's:
1 2 3 4 5 6 7 8 9 10
||=== Build: Debug in Detect Name Files (compiler: GNU GCC Compiler) ===|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp||In function 'int main()':|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp|30|error: no match for'operator=' (operand types are 'std::stringstream {aka std::basic_stringstream<char>}' and 'std::basic_string<char>')|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp|30|note: candidate is:|
F:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\sstream|502|note: std::basic_stringstream<char>& std::basic_stringstream<char>::operator=(const std::basic_stringstream<char>&)|
F:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\sstream|502|note: no known conversion for argument 1 from 'std::basic_string<char>' to 'const std::basic_stringstream<char>&'|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp|32|error: initializer fails to determine size of 'szInitialDir'|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp|32|error: array must be initialized with a brace-enclosed initializer|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
Im new in c++, sorry for my english, this is not an homework, just an personal project! Thanks in advance!
Thank you but it fixed only 1 error, there's 2 more error's"
1 2 3 4 5 6
||=== Build: Debug in Detect Name Files (compiler: GNU GCC Compiler) ===|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp||In function 'int main()':|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp|33|error: initializer fails to determine size of 'szInitialDir'|
F:\Projects\C++\Code Blocks\Mine\Detect Name Files\main.cpp|33|error: array must be initialized with a brace-enclosed initializer|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
I still dunno now how to fix this :P
*This is not an homework!*