habe mal wieder ein Problem
#include <stdafx.h>
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const string copy = "copy ";
char cPath[255];
string sPath;
string aPath;
char cFolderName[255];
char cFolderNameNew[255];
char cNumber[255];
string sCommand;
string sCommanda;
// Pfad einlesen
cout << "Wo ist der alte Ordner gespeichert?" << endl;
cin.getline(cPath, 255);
sPath = cPath;
// Wenn am Ende des Pfades kein \ ist, füge es hinzu
if (sPath[sPath.length() - 1] != '\\')
{
sPath = sPath + "\\";
}
// Ordnername einlesen
cout << "Wie heist der alte Ordner?" << endl;
cin.getline(cFolderName, 255);
// Pfad einlesen
cout << "Wo soll der neue Ordner hin?" << endl;
cin.getline(cPath, 255);
aPath = cPath;
// Wenn am Ende des Pfades kein \ ist, füge es hinzu
if (aPath[aPath.length() - 1] != '\\')
{
aPath = aPath + "\\";
}
// Ordner erstellen
int i=1;
itoa(i, cNumber, 10);
sCommand = copy + "\"" + sPath + cFolderName "\"" + "\"" + aPath + "\"";
// Ordner erstellen
cout<<sCommand;
//system(sCommand.c_str());
cout << endl << "Fertig!" << endl << endl;
getch();
return 0;
}
Die fett makierte Zeile funktioniert so nicht.
Das Programm soll nach eingabe von
d: hallo.doc d:help
die datei hallo.doc nach d:help kopieren. doch mit der Pfadeingabe,die variabel bleiben soll, funktioniert so noch nicht.
Kann jemand helfen
#include <stdafx.h>
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const string copy = "copy ";
char cPath[255];
string sPath;
string aPath;
char cFolderName[255];
char cFolderNameNew[255];
char cNumber[255];
string sCommand;
string sCommanda;
// Pfad einlesen
cout << "Wo ist der alte Ordner gespeichert?" << endl;
cin.getline(cPath, 255);
sPath = cPath;
// Wenn am Ende des Pfades kein \ ist, füge es hinzu
if (sPath[sPath.length() - 1] != '\\')
{
sPath = sPath + "\\";
}
// Ordnername einlesen
cout << "Wie heist der alte Ordner?" << endl;
cin.getline(cFolderName, 255);
// Pfad einlesen
cout << "Wo soll der neue Ordner hin?" << endl;
cin.getline(cPath, 255);
aPath = cPath;
// Wenn am Ende des Pfades kein \ ist, füge es hinzu
if (aPath[aPath.length() - 1] != '\\')
{
aPath = aPath + "\\";
}
// Ordner erstellen
int i=1;
itoa(i, cNumber, 10);
sCommand = copy + "\"" + sPath + cFolderName "\"" + "\"" + aPath + "\"";
// Ordner erstellen
cout<<sCommand;
//system(sCommand.c_str());
cout << endl << "Fertig!" << endl << endl;
getch();
return 0;
}
Die fett makierte Zeile funktioniert so nicht.


Das Programm soll nach eingabe von
d: hallo.doc d:help
die datei hallo.doc nach d:help kopieren. doch mit der Pfadeingabe,die variabel bleiben soll, funktioniert so noch nicht.
Kann jemand helfen
