Pfad zusammenbauen in Variable
-
Was ich jetzt versuche ist das in buffer_1[ ]der Pfad zusammengebaut drinsteht.
Mit _tprintf klappt das so nur ist char dafür nicht gemacht. Wie löse ich das?{ // Valid file path name (file is there). char buffer_1[ ] = ("%s\\%s\\Reader\\AcroRd32.dll" ,"c:\\Program Files (x86)\\Adobe",ffd.cFileName); char *lpStr1; lpStr1 = buffer_1; // Return value from "PathFileExists". int retval; // Search for the presence of a file with a true result. retval = PathFileExists(lpStr1); if(retval == 1) { cout << "Search for the file path of : " << lpStr1 << endl; cout << "The file requested \"" << lpStr1 << "\" is a valid file" << endl; cout << "The return from function is : " << retval << endl; } else { cout << "\nThe file requested " << lpStr1 << " is not a valid file" << endl; cout << "The return from function is : " << retval << endl; } }
-
Wir sind im C++ Forum, und sprechen daher aus Prinzip kein C.
{ std::string path = "c:\\Program Files (x86)\\Adobe"; path += "\\"; path += ffd.cFileName; path += "\\Reader\\AcroRd32.dll"; int retval = PathFileExists(path.c_str()); if(retval == 1) { cout << "Search for the file path of : " << path << endl; cout << "The file requested \"" << path << "\" is a valid file" << endl; cout << "The return from function is : " << retval << endl; } else { cout << "\nThe file requested " << path << " is not a valid file" << endl; cout << "The return from function is : " << retval << endl; } }Und selbst das geht noch in besserem C++, wenn weitere Einzelheiten bekannt seien.