User Tools

Site Tools


c_-_files:file_copy

This is an old revision of the document!


C - Files - File Copy

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<stdio.h>
 
void main()
{
  clrscr();
  char ch,st[100];
  ofstream o("r.txt");
 
  do 
  {
    ch=cin.get();
    fflush(stdin);
    o.put(ch);
  } while(ch!='.');
 
  o.close();
  ifstream i;
  i.open("r.txt");
  ofstream k;
  k.open("m.txt");
 
  while(!i.eof()) 
  {
    i.read((char*)&st,sizeof(st));
    k.write((char*)&st,sizeof(st));
    cout<<"\n After copying of the file:";
    cout<<st; 
  }
 
  getch(); 
}
c_-_files/file_copy.1507821029.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki