Hello
what I am doing here is trying to make a simple program that fixes the damage caused by hidden files virus if you know it, it simply change the attributes from system & hidden files to normal files,
I have managed to do that with CMD, and I have fixed my flash, but I thought it will be better to make it as a program and submit it to the public so that they use it too.
I have only one problem, I need to insert the char drive to system() but I don't know how
1 2 3
|
char drive;
cin>>drive;//lets say that user entered G
system("drive:")//Need help here <<<<<<<<<<<<<<<<<<<<<<<<
|
i want it here to enter G,plus :
How can I use a variable inside system() function?
I have event tried this:
1 2
|
system(drive":");//Need help here <<<<<<<<<<<<<<<<<<<<<<<<
system("attrib -s -h /s /d *.*");
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
cout<<"\t\tThis program is free ware\n";
cout<<"\t\tMade by Yousef Al-Hadhrami\nThis prgoram retrives hidden folders in flash drive caused by viruses\n\n";
cout<<"Enter flash drive(\"Example : F\") :- ";
char drive;
cin>>drive;
cout<<"You have entered drive "<<drive<<":";
cout<<"\nStart processing? y/n : ";
char start;
cin>>start;
if(start=='y'||start=='Y')
{
cout<<"Please wait, This may take long time (according to folders in your flash)... ... ...";
system("drive:");//Need help here <<<<<<<<<<<<<<<<<<<<<<<<
system("attrib -s -h /s /d *.*");
}
cout<<"Your files should be back now :) \n";
system("pause");
}
|
Here is the CMD method source :
http://ezelovesse7en.blogspot.com/2012/01/tips-unhide-hidden-files-caused-by.html
and one more thing, I think using system() is legit here because I need it to do the job done ^_^, although system() is evil