VB icon

^!!~File Write~!!^

Email
Submitted on: 1/4/2015 7:32:00 AM
By: fritz0x00 (from psc cd)  
Level: Beginner
User Rating: By 9 Users
Compatibility: C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
Views: 1727
 
     Prompts input and writes it to a file
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :^!!~File Write~!!^
//**************************************
#include <fstream.h>
#include <iostream.h>
#include <stdlib.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: ^!!~File Write~!!^
// Description:Prompts input and writes it to a file
// By: fritz0x00 (from psc cd)
//
// Side Effects:File Writing
//**************************************

//by fritz300 of http://hax-studios.net
#include <fstream.h>
#include <iostream.h>
#include <stdlib.h>
int main()
{
	//** Declare Varibles, Theres only one
	char text[80];
	
	//** Declare pointers
	ifstream fin;
	ofstream fout;
	//** Begin; tell user what he/she is about to do
	cout << "Welcome to Fritzs Text Write program, This program (with source code included) \nwill teach you how to write text to files!\n\n";
	//** End;
	cout << "Type a word:\n";
	cin >> text;
	fout.open("c:/windows/desktop/file.txt"); //** Opens the file to write too.
	fout << "Fritzs Text Write Program Example:\n\nYou typed:\n\n\t";
	fout << text; //** Writes the input to file.txt
	fout.close();
	//** Error handler aka what happens if a error occurs
	if( !fin || !fout )
	{
		cout<<"Error has occured. Cannot open file.txt\n\n" << endl;
	}
	cout<<"\nText was successfully written to C:/windows/desktop/file.txt\n" << endl;
	cout << "\n\n\tText write program by Zak Farrington alias fritz owner of hAx Studios Ltd. <http://hax-studios.net> development team." << endl;
	system("PAUSE"); 
 	return 0;
}


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

10/27/2015 7:05:00 AMyangqian3145

suit for beginer
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.