How to write a C++ Program which initializes a string variable and outputs the string to the disk file in C++ programming.
![]() |
C++ Program which initializes a string variable and outputs the string to the disk file in C++ programming. |
//Program which initializes a string variable and outputs the string to the disk file.
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
clrscr();
char a[]="Program which initializes a string variable and outputs the string to the disk file.";
ofstream ofile("disk.txt");
ofile<<a;
ofile.close();
char b;
ifstream ifile("disk.txt");
while(!ifile.eof())
{
ifile.get(b);
cout<<b;
}
getch();
}
This C++ Program which initializes a string variable and outputs the string to the disk file in C++ programming.
Learn More :
Data File Handling
- C++ Program To Count Number Of Alphabets In A File
- C++ File Handling Binary files - class EMPLOYEE
- C++ Program To Write Numbers 1 to 100 in a data file
- Read Content From a Text File then Count and Display the Number of Alphabets
- C++ Program to count number of blanks present in a text file
- C++ Program to count number of words in a text file
- C++ Program to Counting Words "the" in a Text File