User Tools

Site Tools


c_-_c_files:file_copy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
c_-_c_files:file_copy [2017/10/12 15:06] peterc_-_c_files:file_copy [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== C - C++ Files - File copy ====== ====== C - C++ Files - File copy ======
- 
-<code c> 
-#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();  
-} 
-</code> 
- 
- 
-===== Another example ===== 
  
 <code cpp> <code cpp>
Line 80: Line 40:
 } }
 </code> </code>
 +
 +and
 +
 +<code c>
 +#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(); 
 +}
 +</code>
 +
 +
  
c_-_c_files/file_copy.1507820791.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki