0
C++ Prog. To update the contents using random access .
Want. A cpp program to update the contents using random access .
3 Antworten
+ 1
Now I think you should try yours 😉
Rock the code🤟🤟
0
Please inform me anyone if anyone thinks that I shouldn't provide the code to begginers.
I will just del it.
But this includes my work towards the discussion box. This code take a lot time to write!
- 2
To update the content in c++ using random access is possible
Here's your code -
//Reading from available file content
//then writing the content to another
//file. Firstly, create file for reading (can include path)
//let says "C:\sampleread.txt", at root on C drive.
//Type some text as shown…
//Then executes this program.
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
//function definition, to open file for reading...
void openinfile(ifstream &infile)
{
char filename[100];
cout<<"Enter the file name: ";
//Enter the filename that you have created
//(can include path). From the comment above
//you have to enter "C:\sampleread.txt"
//without the double quotes.
cin>>filename;
infile.open(filename);
}
void main(void)
{
//declare the input file stream
ifstream inputfile;
//declare the output file stream
ofstream outputfile;
char chs;
//function call for opening file for reading...
openinfile(inputfile);
//create, if not exist and open it