Which operator is used to insert the data into file in C++?
In C++, which function is used to set the position of the next character to be extracted from the input stream?
What is the output of this C++ program?
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
int length;
char * buffer;
ifstream is;
is.open ("sample.txt", ios :: binary );
is.seekg (0, ios :: end);
length = is.tellg();
is.seekg (0, ios :: beg);
buffer = new char [length];
is.read (buffer, length);
is.close();
cout.write (buffer, length);
delete[ ] buffer;
return 0;
}
What is the output of this C++ program?
#include<iostream>
#include <fstream>
using namespace std;
int main ()
{
ofstream outfile ("test.txt");
for (int n = 0; n < 100; n++)
{
outfile << n;
outfile.flush();
}
cout << "Done";
outfile.close();
return 0;
}
By seeing which operator does this C++ program stop getting the input?
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
char ch;
streambuf * p;
ofstream os ("test.txt");
auto pbuf = os.rdbuf();
do {
ch = cin.get();
p -> sputc(ch);
} while (ch != '.');
os.close();
return 0;
}
Which member function is used to determine whether the stream object is currently associated with a file in C++?
Which header file is used for reading from and writing to a file in C++?
In C++, for binary files, a ______ must be appended to the mode string.
In C++, in case of error fopen() will return?
In C++, FILE is of type?
What is the meant by ‘a’ in the following operation in C++?
fp = fopen(“Random.txt”, “a”);
In C, fputs function writes a string to a file that only ends with a newline?
What is the output of this C code?
#include <stdio.h>
#include <string.h>
int main()
{
char line[3];
FILE *fp;
fp = fopen("newfile.txt", "r");
while (fgets(line, 3, fp))
fputs(line, stdout);
return 0;
}