Questions:
C Plus Plus Program to Create a File & Store Information
Explanation:
This tutorial will teach you how to write on a file. This requires another standard C++ library called fstream, which defines three new data types:
ofstream : This data type represents the output file stream and is used to create files and to write information to files.
Code:
Output:
Related Articles:
C Plus Plus Program to Create a File & Store Information
C Plus Plus Program to Create a File & Store Information
Explanation:
This tutorial will teach you how to write on a file. This requires another standard C++ library called fstream, which defines three new data types:
ofstream : This data type represents the output file stream and is used to create files and to write information to files.
Code:
#include<iostream>
#include<fstream>
using namespace std;
void main() {
ofstream file("Temp.txt");//creating txt file
int number1 = 12345;
cout
<< "Writing data on
file";
file
<< "cppexamples.blogspot.com";//wring
cppexamples.blogspot.con on file..
file
<< endl;
file
<< number1;
/*
you
can find Temp.txt file in project folder.
*/
file.close();
}
Output:
Related Articles:
C Plus Plus Program to Create a File & Store Information
0 Questions:
Post a Comment