-
siavoshkc, your program has a memory leak. you did not delete your dynamically allocated memory. you should definitely stick with the standard string class for this kind of task, like ChaosEngine said.
sure it's more of a challenge to use pointers, but it's even MORE of a challenge debugging your memory leaks when you start to have problems...
-
I didn't want to use pointers. Look at my first code.
-
Here it is so far, got one error now :(
Code:
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
char *Input;
char Command[64];
Input=&Command;
cin>>Command;
cout<<*Input;
WinExec(Command, 1);
}
Oh yeah why do I have to put the number in the WinExec, does it matter what the number is?
-
I dont think char needs refrence operators...
-
Code:
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
char *Input;
char Command[64];
Input = Command;
cin >> Command;
cout << Input;
WinExec(Command, SW_SHOW);
}
The number is a nCmdShow parameter, the same as those you would pass to ShowWindow(..)