Jul 29, 2016 at 3:29pm UTC
#include <direct.h>
int main()
for(;;) {
mkdir("c:/myfolder");
return 0;
}
I want to make c:/myfolder then c:/myfolder1, c:/myfolder2 and etc...
Last edited on Jul 29, 2016 at 3:31pm UTC
Jul 29, 2016 at 4:48pm UTC
Wow that's cool. But if I want to copy file like .cpp like that?
Last edited on Jul 29, 2016 at 4:50pm UTC
Jul 29, 2016 at 8:15pm UTC
> But if I want to copy file like .cpp like that?
What do you mean?
Jul 29, 2016 at 8:32pm UTC
like untitled.cpp copy to c:\\untitled0.cpp, c:\\untitled1.cpp and etc...
P.S. look at pm.
Jul 29, 2016 at 8:35pm UTC
Then you know the function mkdir() which is used to make a new folder, do you know the function that copies a file?
Jul 29, 2016 at 8:46pm UTC
copy_file("C:\\Untitled.cpp","D:\\Untitled.cpp"); but what to do with "folder" and what to write instead?
Last edited on Jul 29, 2016 at 8:47pm UTC
Jul 29, 2016 at 8:52pm UTC
Or :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <direct.h>
#include <stdio.h>
#include <cstring>
int main()
{
int i = 0;
char file[100];
for ( ;; )
{
sprintf(file, "c:\\untitled%d.cpp" , i++);
copy_file(file, "c:\\untitled.cpp" );
}
return 0;
}
Note : Warnings ahead. Don't try this at home.
Last edited on Jul 29, 2016 at 8:53pm UTC
Jul 29, 2016 at 10:27pm UTC
Yes, it does, thanx, maybe can you give me example of copying untitled0.cpp file once but if it exists create untitled1.cpp or somehow?
Last edited on Jul 29, 2016 at 10:28pm UTC
Jul 29, 2016 at 11:23pm UTC
> Maybe can you give me example of copying untitled.cpp file once but if it does not exist create untitled.cpp or somehow?
Is it what you meant?
Last edited on Jul 29, 2016 at 11:27pm UTC
Jul 30, 2016 at 8:02am UTC
I wrote:
> maybe can you give me example of copying untitled0.cpp file once but if it exists create untitled1.cpp or somehow?
Last edited on Jul 30, 2016 at 8:09am UTC
Jul 30, 2016 at 10:25am UTC
> Maybe can you give me example of copying untitled0.cpp file once but if it exists create untitled1.cpp or somehow?
Can you clarify what you mean?
Jul 30, 2016 at 12:31pm UTC
open .exe (cik cik) which copies file from d:\\untitled.cpp to c:\\untitled0 .cpp (if c:\\untitled0.cpp does not exits). But c:\\untitled0.cpp exists, copy_file(d:\\untitled.cpp, c:\\untitled1 .cpp, 0).
Last edited on Jul 30, 2016 at 12:35pm UTC
Jul 30, 2016 at 12:37pm UTC
If it's difficult never mind. It's not important for me, I'm just curious. You helped me a lot generally.
Last edited on Jul 30, 2016 at 6:28pm UTC