<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>file write | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/file-write/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 13 Mar 2010 18:08:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ class program to illestrate File operations</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-illestrate-file-operations/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-illestrate-file-operations/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 18:08:00 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c++ class]]></category>
		<category><![CDATA[File operations]]></category>
		<category><![CDATA[file open]]></category>
		<category><![CDATA[file write]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1070</guid>

					<description><![CDATA[<p>AIM Write a program to illustrate the write() member function which are usually used for transfer of data blocks to the file. ALGORITHM 1. Start the process 2. Invoke the class a. Create two inline member functions .ie, getdata() and dispdata() i. getdata() for input ii. dispdata() for display 3. Open the file in fstream</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-illestrate-file-operations/">C++ class program to illestrate File operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>AIM</strong><br />
	Write a program to illustrate the write() member function which are usually used for transfer of data blocks to the file.</p>
<p><strong>ALGORITHM</strong></p>
<p>1.	Start the process<br />
2.	Invoke the class<br />
a.	Create two inline member functions .ie, getdata() and dispdata()<br />
i.	getdata() for input<br />
ii.	dispdata() for display<br />
3.	Open the file in fstream mode<br />
4.	Write the data in to the file<br />
5.	Slose the file<br />
6.	Stop the process</p>
<p><strong>PROGRAM</strong></p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
class student
{
private:
int rno;
char name[10];
float fees;
public:
void getdata()
{
cout<<"roll number";
cin>>rno;
cout<<endl;
cout<<"enter name:";
cin>>name;
cout<<endl<<"enter fees:";
cin>>fees;
}
void dispdata()
{
cout<<"Roll number"<<rno<<endl;
cout<<"Name"<<name<<endl;
cout<<"Fees"<<fees;
}
};

void main()
{
student s1;
clrscr();
ofstream stdfile("c:\\std.txt");
//fstream stdfile;
//stdfile.open("c:\\std.txt",ios::out|ios::in);  //open file for output
char wish;
//writing to the file
do
{
s1.getdata();
stdfile.write((char*)&#038;s1,sizeof(student));
cout<<"continue ? y/n";
cin>>wish;
}
while(wish=='y'||wish=='Y');
stdfile.close();   //close the file

getch();
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>Roll number  121<br />
Enter name  Jacob<br />
Enter fees   10000</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-illestrate-file-operations/">C++ class program to illestrate File operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-illestrate-file-operations/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
