[CP 2] M7 - File Handling

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

Filename

1 / 44

flashcard set

Earn XP

Description and Tags

45 Terms

1

Filename

Refers to the name of the file

New cards
2

fclose()

Closes a file

New cards
3

w

File mode that opens or create a text file in writing mode

New cards
4

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;

}

New cards
5

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);

}

New cards
6

fprintf()

A function directly writes into the file:

New cards
7

Append

An operation wherein data is added to the existing data of a file

New cards
8

fp = fopen("one.txt", "w");

What is correct syntax for fopen()?

New cards
9

File pointer

It points to a structure that contains about the file:

New cards
10

fstream

A C++ library that allows working with files

New cards
11

fstream

Which of the following is used to create a stream that performs both input and output operations?

New cards
12

fstream

Which stream class is used to both read and write on files?

New cards
13

After pressing return key

When will the cin can start processing of input?

New cards
14

writes to a file

What is meant by ofstream in c++?

New cards
15

fstream

Which stream class is used to both read and write on files?

New cards
16

bool

What is the return type open() method?

New cards
17

getline

What can be used to input a string with blank space?

New cards
18

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;

}

New cards
19

<<

Which operator is used to insert the data into the file? >> <<

New cards
20

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

New cards
21

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

New cards
22

fopen()

Writes a character to a file:

New cards
23

getc()

Reads a character from a file:

New cards
24

FILE *fp;

What is the correct syntax for declaring a file pointer?

New cards
25

fopen()

Creates a new file or open an existing file

New cards
26

a

File mode that opens a text file in append mode

New cards
27

text

By default, all the files in C++ are opened in _________ mode.

New cards
28

ifstream

Which stream class is to only read from files?

New cards
29
<fstream\>

Which header file is required to use file I/O operations?

New cards
30

reading a file

The ifstream would be used when:

New cards
31

fprint()

Writes a set of data to a file

New cards
32

fclose

It is the inverse of fopen, it breaks the connections between the file pointer and the external nam that was established by fopen

New cards
33

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;

}

New cards
34

is_open

Which member function is used to determine whether the stream object is currently associated with a file?

New cards
35
\#include<fstream\>

Which header file is used for reading and writing to a file?

New cards
36

fclose(fp);

What is the correct syntax for fclose()?

New cards
37

File

It is created for the permanent storage of data.

New cards
38

end of file

EOF means ______________________________

New cards
39

r

File mode that opens a text in reading mode

New cards
40

fstream

Which of the following header file is required for creating and reading files?

fstream

ifstream

ofstream

stream

New cards
41

<<

Which operator is used to insert the data into the file? >

>>

<<

<

New cards
42

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;

}

New cards
43

ofstream

Which of the following is used to create an output stream?

iostream

ifstream

fstream

ofstream

New cards
44

ofstream

Which stream class is to only write on files?

New cards
45

file ata

sequence of bytes on the disk where a group of related data is stored

New cards

Explore top notes

note Note
studied byStudied by 83 people
... ago
5.0(1)
note Note
studied byStudied by 16332 people
... ago
4.9(156)
note Note
studied byStudied by 131 people
... ago
5.0(1)
note Note
studied byStudied by 13 people
... ago
5.0(1)
note Note
studied byStudied by 208 people
... ago
5.0(1)
note Note
studied byStudied by 35 people
... ago
5.0(1)
note Note
studied byStudied by 81 people
... ago
5.0(1)
note Note
studied byStudied by 41100 people
... ago
4.9(218)

Explore top flashcards

flashcards Flashcard (85)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (21)
studied byStudied by 13 people
... ago
5.0(1)
flashcards Flashcard (98)
studied byStudied by 26 people
... ago
5.0(1)
flashcards Flashcard (100)
studied byStudied by 10 people
... ago
5.0(1)
flashcards Flashcard (61)
studied byStudied by 6 people
... ago
5.0(1)
flashcards Flashcard (63)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (67)
studied byStudied by 25 people
... ago
5.0(1)
flashcards Flashcard (31)
studied byStudied by 5 people
... ago
5.0(1)
robot