I want to know how to create files in a specific directory, like placing it in exactly C:\Program Files\myfile\w00t.txt, and not just putting it in C:\C compiler\bin\myfile\w00t.txt. so far, i've been using fstream, but i know there are other ways
I want to know how to create files in a specific directory, like placing it in exactly C:\Program Files\myfile\w00t.txt, and not just putting it in C:\C compiler\bin\myfile\w00t.txt. so far, i've been using fstream, but i know there are other ways
Easy! just put C:\Program Files\myfile\w00t.txt instead of w00t.txt...
Code:ofstream out( "C:\\Program Files\\myfile\\w00t.txt" );
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
But what if you would make a loop within the program?? Would it create a text file over and over and over and over and over and over again??
What if you would change this:
ofstream out( "C:\\Program Files\\myfile\\w00t.txt" );
Into this:
ofstream out( "C:\\Program Files\\myfile\\w00t.exe" );
And if the program would be 'evil' and self-replicating.. than.. well, you know what
it would make it obvious which program was doing it if you did it that way, and it would keep overwriting the same file... you'd have to use a variable that changes with each loop to create mulitple files, and the system would most likely stop it very fast...i'm not sure if that works, but you could try it... i would make teh loop alot smaller tho...Code:... ofstream out; int i; char filename[256]; for(i=0;i<32000;i++) { strcpy(filename,"C:\\Program Files\\myfile\\w00t.exe"); strcat(filename,i); strcat(filename,".exe"); out.open( filename,ios::trunc); ... out.close(); } ...
Last edited by major_small; 06-15-2003 at 08:16 PM.
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT