0

hi Ive been working on a program that finds hidden files copies the contents and then deletes the hidden file so far ive got

system("set OLDDIR=%CD%&&@ECHO OFF&&ECHO Finding Hidden Files&&dir /ah&&PAUSE");
printf("Please Choose The Files You Want To repair separated by spaces\n");
scanf("%c",&d1);
getchar();
string cmd="echo"+d1;
system(cmd.c_str());

but im having a problem transferring the variable d1 to the system() command any help would be greatly appreciated
thanks in advance

Edited by mike_2000_17: Fixed formatting

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by MrNoob
0

You can not set environment variables like that because they are set only while the system() function is running. As soo as system() returns to your program the new environment variables disappear. Its identical behavior in MS-Windows and *nix operating systems.

0

yea but i dont want them to keep the values outside of system() u understand i want to be able to use the user declared values within the system environment thats the main thing i need the user to input the value and then i need it to be used in the system() for one time

0

you can cr8 a batch file that check attributes of hidden files and then write to batch file after you retrieve them write deleting attribute but thats long task i think there api for these stuff

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.