IO Flashcards

Input Output in Ruby

You may prefer our related Brainscape-certified flashcards:
1
Q

STDIN

A

standard input, gets info explicity from user ex. STDIN.gets.chomp()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

r

A

Read-only, starts at beginning of file (default mode).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

r+

A

Read-write, starts at beginning of file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

w

A

Write-only, truncates existing file to zero length or creates a new file for writing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

w+

A

Read-write, truncates existing file to zero length or creates a new file for reading and writing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

a

A

Write-only, starts at end of file if file exists, otherwise creates a new file for writing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

a+

A

Read-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

b

A

Binary file mode (may appear with any of the key letters listed). Suppresses EOL CRLF conversion on Windows. And sets external encoding to ASCII-8BIT unless explicitly specified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

t

A

Text file mode (may appear with any of the key letters listed except “b”).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

seek

A

method class of IO, moves the file pointer to a given integer distance(first parameter) in the stream according to the value of the second parameter in the seek method ex. def rewind(f) f.seek(0, IO::SEEK_SET) end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

IO::SEEK_CUR

A

Seeks to first integer number parameter plus current position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

IO::SEEK_END

A

Seeks to first integer number parameter plus end of stream (you probably want a negative value for first integer number parameter)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

IO::SEEK_SET

A

Seeks to the absolute location given by first integer number parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly