|
I thinked that the files of the folder could be deleted in this way and finally the empty folder that is not important can be deleted from the system instructions.
This idea is feasible, but the only concern is about the complexity for the huge folders with various subfolders; it is time consuming.
|
|
|
|
|
MehdiHazrati wrote: it is time consuming. That's why we write programs.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Is there alternative solution to do this?
Specially for wiping a drive
|
|
|
|
|
MehdiHazrati wrote: Specially for wiping a drive Format it, perhaps?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
You can access a volume or physical disk through the CreateFile() [^] function. This would allow you to overwrite all information including the file system tables.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
MehdiHazrati wrote: This idea is feasible, but the only concern is about the complexity for the huge folders with various subfolders; it is time consuming. Have you considered SHFileOperation() or IFileOperation() ? They can recursively delete subfolders.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
From the other responses presumably the following is what you want to do.
1. You want to shred files.
2. You want to shred file information in the directory itself.
For 1 you iterate over files in the directory and recurse through each sub directory and shred each file. You MUST do this. There is no magic solution that would allow you to do it in some other way.
For 2 it is more complex and depends on what you want you think a 'shred' would do. At a minor level you can just rename each file before shredding it. That overwrites the name. For a real shred you would need to
1. Create an API to access the file system at a raw level
2. Parse the file block
3. Shred the relevant file info that was found by step 1. In this case 'shred' includes the same basic methodology employed to shred a file but on a very small scale. You would need to write the shred code yourself.
Note that if you choose to implement the solution above then you MUST back up your hard drive because when you mess up the code you will need to reformat the hard drive. You must also extensively test this feature as well for the same reason. Also account for different file system types (like ssd and usb.)
|
|
|
|
|
thank you for your instructions
but I want to know if there is any way to rewrite the folder area outright and do not delete its files one by one
Regards.
|
|
|
|
|
MehdiHazrati wrote: but I want to know if there is any way to rewrite the folder area outright and
do not delete its files one by one
No.
File systems do not work like that.
|
|
|
|
|
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char again;
do{
printf("insert y or Y to repeat");
fflush(stdout);
scanf("%c",&again);
}while(again=='y'||again=='Y');
}
i wrote this code to create a loop that when insert y or Y do the job again but did not work.when i enter first y the loop be end.
|
|
|
|
|
As mentioned in the QA section: Please don't cross post. I decided to answer you here.
Did you take a look at "again" in the debugger? You will recognize that in the second round thru the loop it will have the value 0x0a == \r it's the carriage return from your input.
You can try something like this to catch the CR:
char cr;
char again;
do
{
printf("insert y or Y to repeat");
fflush(stdout);
again = getchar();
cr = getchar();
}while(again=='y'||again=='Y');
|
|
|
|
|
thank you very much Andy411.its work good.
what do you use
cr = getchar();
what do this code
|
|
|
|
|
How do you learn C? Don't you have a book or a tutoroial with an index?
That's what google answered me:
http://www.cplusplus.com/reference/cstdio/getchar/[^]
PS: Sorry if my answer sounds a bit rude, but I am realy confused about the question what getchar does. If I were you, my first step would be asking google, bing are whatever searchmachine you want. Or taking a look inside a book. If I don't understand the description/answer there, I would ask in a forum again.
|
|
|
|
|
run your code ,you will get the result.
"insert y or Y to repeatY insert y or Y to repeat"
then code end.
it is useless.
fflush(stdout);
you can write
fflush(stdin);
|
|
|
|
|
is there any body work with eclipse c\c++ ide ?
I write this code in eclipse C\C++ IDE but did not work.
its work in codeblocks bud didnt work in eclipse c++ ide.
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int a=100;
do{
printf("insert a");
scanf("%d",&a);
}while(a<10);
return (0);
}
|
|
|
|
|
what is not working ? compile error ? execution error ?
Nihil obstat
|
|
|
|
|
it compile but the console tab did not show any thing.and when i push the stop button and stop the project just show "insert a" and stop.
|
|
|
|
|
This is the third time you have posted this question. Please stop repeating yourself.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
i write this cod in eclipse c\c++ ide but did not work.
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int a=100;
do{
printf("insert a");
scanf("%d",&a);
}while(a<10);
return (0);
}
|
|
|
|
|
What didn't work?
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
I just tested it and it works fine.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
sorry you test it in eclipse c\c++ ide?
|
|
|
|
|
Well I see you already got an answer in Q&A. Please do not post questions in more than one forum in future.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
i use eclipse newly but this code did not work in this ide
|
|
|
|