Comments

Monday, October 8, 2012

Create File and Put Some Message into It

Posted by at 2:38 PM Read our previous post

Create a file "Test.txt" and enter some text message into it.



Source code

#include <iostream>
#include <fstream>
using namespace std;
void main()
{
       char input[10];
       ofstream myfile;
       myfile.open("test.txt");
       cout<<"Type your message here"<<endl;
       cin.getline(input,10);
       myfile<<"The message is "<<input<<endl;
       myfile.close();
}

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template