in c++ the source code is as follows........... .
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<stdio.h>
void main()
{
clrscr();
int f=0;
char s[30],c[10];
ofstream of("old.txt");
cout<<"enter string\n";
cin.getline(s,20);
of<<s;
of.close();
ifstream fi("old.txt");
ofstream fo("new.txt");
while(!fi.eof())
{
fi>>c;
if(strcmp(c,"the")==0)
{
f++;
}
else
fo<<c<<" ";
}
cout<<"occ:"<<f;
remove("old.txt") ;
rename("new.txt","old.txt");
fo.close();
fi.close();
ifstream n("old.txt");
n.seekg(0,ios::beg);
cout<<"\nnew file\n";
while(!n.eof())
{
n.getline(s,20);
cout<<s;
}
n.close();
getch();
}
REM deletes a file C: del filename exit Create a file, above, using wordpad and save it with the extension .BAT Modify the line C: del filename, to indicate where the file is and instead of 'filename' write the name of the file you want to delete. (REM is just a remark to remind you what it does..) Say you call the batch file 'deleter.bat', then you have to include this file name in the startup program file. This will depend on what operating system you are using. Old DOS, would use an autoexec.bat file. You could then actually add the delete command in with the autoexec.bat file.
Assuming you know the location of the infected file: For example if there was an infected file at c:\temp\abcde.exe Load CMD (cmd.exe) At the c:\> type del c:\temp\abcde.exe this will delete the infected file aslong as the file is not being protected or has permissions preventing deletion.
Hold shift when deleting to skip recycle bin and delete file completely
The command for deleting a file in DOS is DEL. If the file you are trying to delete is in the current directory, type DEL followed by the full filename. E.g. del file001.txt If there are multiple files, the wildcard * can be used. del file*.txt will delete all the text files that start with 'file' del file*.* will delete all the files that start with file. del *.txt will delete all the text files. del *.* will delete all the files in the current directory. It is possible to delete files in another directory by typing the full path and filename del c:\folder01\*.* will delete all the files in the directory c:\folder01\ DEL will not affect hidden files, but careless use of this command could damage your operating system so use with care.
To delete all the existing data in a file, simply open it in write mode. If you open the file in append mode, you need to overwrite the existing data to delete part or all of that data.
You can run this in a .bat file del "C:\Text Files\*.txt"
When you open a file in write mode, eg. fp=fopen("filename.txt","w"); the content of the file is deleted.
program to extract a given word from a file
That depends on the type of file and what you mean by "empty". Generally, fopen() called on an existing file, with the "w" option instead of the "a" option will truncate the file to zero length. To delete a file completely is a different process. Function truncate is your friend.
my computer--c:--windows--hinhem.scr right click on file--delete then empty the recycle bin
You select the text. To copy the selected text into the clipboard, you press <Ctrl>C, or <Ctrl>X if you want to delete it. To paste it into the second file, press <Ctrl>V. There are also sequences using the <Insert> and <Delete> keys, but I rarely use them, so I am not familiar with them.
The command is as follows : del c:\[directory you want to delete] /s This would need to be in a text file created in notepad, and saved as a .bat file. Or you could type EDIT from the command line to bring up the old DOS editor. Improving answer: Step 1: Open up Notepad Step 2: Type the following code in: @echo off deltree [Your hard drive, usually C:]\[Directory you want to delete /s for quietly Step 3: Save as "whateveryouwantwithoutquotes.bat"