Filename
Refers to the name of the file
fclose()
Closes a file
w
File mode that opens or create a text file in writing mode
65
What is the output of the given program?
#include < iostream >
using namespace std;
int main ()
{
char str[] = "Steve jobs";
int val = 65;
char ch = 'A';
cout << val << endl;
return 0;
}
Gets a character, put it into a file pointer until an enter is pressed
What does the following code do?
while( (ch = getchar()) != '\n') {
putc(ch, fp);
}
fprintf()
A function directly writes into the file:
Append
An operation wherein data is added to the existing data of a file
fp = fopen("one.txt", "w");
What is correct syntax for fopen()?
File pointer
It points to a structure that contains about the file:
fstream
A C++ library that allows working with files
fstream
Which of the following is used to create a stream that performs both input and output operations?
fstream
Which stream class is used to both read and write on files?
After pressing return key
When will the cin can start processing of input?
writes to a file
What is meant by ofstream in c++?
fstream
Which stream class is used to both read and write on files?
bool
What is the return type open() method?
getline
What can be used to input a string with blank space?
65
What is the output of the given program?
#include < iostream >
using namespace std;
int main ()
{
char str[] = "Steve jobs";
int val = 65;
char ch = 'A';
cout << val << endl;
return 0;
}
<<
Which operator is used to insert the data into the file? >> <<
Gets a character, put it into a file pointer until an enter is pressed
What does the following code do?
while( (ch = getchar()) != '\n') {
putc(ch, fp);
}
Gets a character, put it into a file pointer until an enter is pressed
Gets a character
Puts character into a variable
Gets a character until enter key is pressed
fgetc()
this function reads the character from the current pointer's positiona nd upon successful read moves the pointer to the next character in the file
fopen()
Writes a character to a file:
getc()
Reads a character from a file:
FILE *fp;
What is the correct syntax for declaring a file pointer?
fopen()
Creates a new file or open an existing file
a
File mode that opens a text file in append mode
text
By default, all the files in C++ are opened in _________ mode.
ifstream
Which stream class is to only read from files?
Which header file is required to use file I/O operations?
reading a file
The ifstream would be used when:
fprint()
Writes a set of data to a file
fclose
It is the inverse of fopen, it breaks the connections between the file pointer and the external nam that was established by fopen
error
What is the output of the given program?
#include < iostream >
using namespace std;
int main ()
{
char str[] = "Steve jobs";
int val = 65;
char ch = 'A';
cout << val << endl;
return 0;
}
is_open
Which member function is used to determine whether the stream object is currently associated with a file?
Which header file is used for reading and writing to a file?
fclose(fp);
What is the correct syntax for fclose()?
File
It is created for the permanent storage of data.
end of file
EOF means ______________________________
r
File mode that opens a text in reading mode
fstream
Which of the following header file is required for creating and reading files?
fstream
ifstream
ofstream
stream
<<
Which operator is used to insert the data into the file? >
>>
<<
<
error
What is the output of the given program?
#include < iostream >
using namespace std;
int main ()
{
char str[] = "Steve jobs
int val = 65;
char ch = 'A';
cout << val << endl;
return 0;
}
ofstream
Which of the following is used to create an output stream?
iostream
ifstream
fstream
ofstream
ofstream
Which stream class is to only write on files?
file ata
sequence of bytes on the disk where a group of related data is stored