Im using the Dev-Cpp compiler. Im trying to create a program like the one below...

#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <iomanip>
#include <fstream>
#include <stdlib.h>

using namespace System;
using namespace System::IO;
using namespace std;
int main() {
    string *com2;  
    wchar_t com;
    char loop;
    
    loop = 'a';
    while(loop = 'a') {
               system("CLS");
               cin >> com;
               
               if(com = 'deldir.') {
                      cout << "directory to delete: ";
                      getline(cin,com2);
                      Directory::Delete(com2, true);
                      }
else
{ 
cout << "Invalid Command..." << endl;
Sleep(2000);
}
                      }
                      return 0;
                      }

It doesn't work. Do I need headers #using <mscorlib.dll> or #include <tchar.h>?
I can't figure it out, thanks in advance...

Would you elaborate a little more on what you are trying to do and what your problem is ?

It looks like you want to delete a directory. I am a little confused by the use of "string *com2" .. why don't you just use "string com2" ? And that while loop is infinite, I don't see you setting "loop" to something else to make it exit.

And it should be while (loop == 'a') NOT while (loop = 'a')

Why are you using wchar_t ? Its a single character, not a string, so if(com = 'deldir.') { isn't going to compile correctly. And deldir isn't a single character either, so it should be in double quotes like any other normal string literal in C/C++, not single quotes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.