It was developed by Bjarne Stroustrup in 1983. Bjarne Stroustrup who was a great admirer and master of C and Simula 67 combined the features of both the languages into more powerful language that could support the concepts of object oriented programming and still could retain the feature of c.
/* Program to make a *.txt file i
n c: drive */
#include<fstream.h> //preprocessor directive
#include<conio.h>
#include<process.h>
#include<conio.h>
#include<process.h>
void main()
{
clrscr(); // clear screen
char line1[50]; // lines to be written in file
char line2[50];
char line3[50];
ofstream fin("c:\\abc.txt"); // abc.txt file placed in c: dive
cout<<"Enter the lines given below"<<endl; // output statement
cout<<"Enter line 1"<<endl;
cin>>line1;
cout<<"Enter line 2"<<endl;
cin>>line2;
cout<<"Enter line 3"<<endl;
cin>>line3;
cout<<"Writing detail into file.............";
fin<<line1<<endl;
fin<<line2<<endl;
fin<<line3<<endl;
getch();
}
{
clrscr(); // clear screen
char line1[50]; // lines to be written in file
char line2[50];
char line3[50];
ofstream fin("c:\\abc.txt"); // abc.txt file placed in c: dive
cout<<"Enter the lines given below"<<endl; // output statement
cout<<"Enter line 1"<<endl;
cin>>line1;
cout<<"Enter line 2"<<endl;
cin>>line2;
cout<<"Enter line 3"<<endl;
cin>>line3;
cout<<"Writing detail into file.............";
fin<<line1<<endl;
fin<<line2<<endl;
fin<<line3<<endl;
getch();
}
Copy the program to the Turbo C++ software, compile and run the the program. you can also increase the number or size of words place in every line of program. Example line4[100]..... so on. To change the location of file to be saved is done by "ofstream fin("c:\\abc.txt");" , if u want to place file in a specific location example "C:\Documents and Settings\All Users" then we have to type "ofstream fin(" c:\\Documents and Settings\\All Users\\abc.txt ");".
In this article i just give an view to make a file using C++, main advantage of this file it can be copied in denied folders which cant be accessed by Users, This article is only for educational purpose. this technique is often used by Hackers to make virus and placed into specific location without knowing the admin, hope every one liked it. Kindly post you views on this article and send feedback.
Be a Real Hacker - PROFESSIONAL, and change the trend of HACKING.
Thanks and regards :
Sahil Mahajan.
Thanks and regards :
Sahil Mahajan.
thank you sir.
ReplyDelete