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

Recommended Answers

All 3 Replies

Use sprintf .

uh im not so good with sprintf do you know any good tuts?

uh im not so good with sprintf do you know any good tuts?

i meant to say uh im not so good with sprintf used with system() do you know any good tuts?

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.