Home
Explore
Exams
Search for anything
Login
Get started
Home
[CP 2] M7 - File Handling
[CP 2] M7 - File Handling
0.0
(0)
Rate it
Studied by 0 people
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Card Sorting
1/44
Earn XP
Description and Tags
University/Undergrad
Add tags
Study Analytics
All
Learn
Practice Test
Matching
Spaced Repetition
Name
Mastery
Learn
Test
Matching
Spaced
No study sessions yet.
45 Terms
View all (45)
Star these 45
1
New cards
Filename
Refers to the name of the file
2
New cards
fclose()
Closes a file
3
New cards
w
File mode that opens or create a text file in writing mode
4
New cards
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;
}
5
New cards
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);
}
6
New cards
fprintf()
A function directly writes into the file:
7
New cards
Append
An operation wherein data is added to the existing data of a file
8
New cards
fp \= fopen("one.txt", "w");
What is correct syntax for fopen()?
9
New cards
File pointer
It points to a structure that contains about the file:
10
New cards
fstream
A C++ library that allows working with files
11
New cards
fstream
Which of the following is used to create a stream that performs both input and output operations?
12
New cards
fstream
Which stream class is used to both read and write on files?
13
New cards
After pressing return key
When will the cin can start processing of input?
14
New cards
writes to a file
What is meant by ofstream in c++?
15
New cards
fstream
Which stream class is used to both read and write on files?
16
New cards
bool
What is the return type open() method?
17
New cards
getline
What can be used to input a string with blank space?
18
New cards
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;
}
19
New cards
<<
Which operator is used to insert the data into the file?
\>>
<<
20
New cards
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
21
New cards
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
22
New cards
fopen()
Writes a character to a file:
23
New cards
getc()
Reads a character from a file:
24
New cards
FILE *fp;
What is the correct syntax for declaring a file pointer?
25
New cards
fopen()
Creates a new file or open an existing file
26
New cards
a
File mode that opens a text file in append mode
27
New cards
text
By default, all the files in C++ are opened in \_________ mode.
28
New cards
ifstream
Which stream class is to only read from files?
29
New cards
Which header file is required to use file I/O operations?
30
New cards
reading a file
The ifstream would be used when:
31
New cards
fprint()
Writes a set of data to a file
32
New cards
fclose
It is the inverse of fopen, it breaks the connections between the file pointer and the external nam that was established by fopen
33
New cards
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;
}
34
New cards
is_open
Which member function is used to determine whether the stream object is currently associated with a file?
35
New cards
\#include
Which header file is used for reading and writing to a file?
36
New cards
fclose(fp);
What is the correct syntax for fclose()?
37
New cards
File
It is created for the permanent storage of data.
38
New cards
end of file
EOF means \______________________________
39
New cards
r
File mode that opens a text in reading mode
40
New cards
fstream
Which of the following header file is required for creating and reading files?
fstream
ifstream
ofstream
stream
41
New cards
<<
Which operator is used to insert the data into the file?
\>
\>>
<<
<
42
New cards
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;
}
43
New cards
ofstream
Which of the following is used to create an output stream?
iostream
ifstream
fstream
ofstream
44
New cards
ofstream
Which stream class is to only write on files?
45
New cards
file ata
sequence of bytes on the disk where a group of related data is stored
Explore top notes
Verpleegkundige visies
Updated 118d ago
Note
Preview
ap bio unit 2 review
Updated 736d ago
Note
Preview
Memory
Updated 525d ago
Note
Preview
Chapter 8: Gases
Updated 837d ago
Note
Preview
“Popular Mechanics” Text Dependent Questions
Updated 1015d ago
Note
Preview
Chapter 31: Money and Banking
Updated 960d ago
Note
Preview
ME2
Updated 131d ago
Note
Preview
Unit 9: Applications of Thermodynamics
Updated 769d ago
Note
Preview
Explore top flashcards
FFA California Forestry Plant ID
Updated 62d ago
Flashcards (119)
Preview
621 unit 1 LOs Lec 1-2
Updated 832d ago
Flashcards (37)
Preview
Learning and memory
Updated 769d ago
Flashcards (24)
Preview
Spanish Irregular Preterit Verbs Stems
Updated 385d ago
Flashcards (27)
Preview
River landscapes
Updated 737d ago
Flashcards (31)
Preview
3H Profesiones
Updated 841d ago
Flashcards (63)
Preview
A2 Criminal Justice Final Exam P1 The CJ System
Updated 859d ago
Flashcards (28)
Preview
UNIT 9 APES
Updated 384d ago
Flashcards (68)
Preview