Starting Out with C++ from Control Structures to Objects (8th Edition)
8th Edition
ISBN: 9780133769395
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 12, Problem 13RQE
Explanation of Solution
The below member functions are used to move the read or write file pointer at any byte in the specified file.
- seekp()
- seekg().
Difference between “seekp” and “seekg” member functions:
seekp | seekg |
The seekp stands for “seek put”. The seekp() function is used to move the file-access pointer anywhere in the file before invoking the put functions. |
The seekg stands for “seek get”. The seekg() function is used to move the file-access pointer anywhere in the file before invoking the get functions... |
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What is the purpose of the delete operator?
What are the functions used to produce
authendicator?
What's the distinction between the urlopen and urlretrieve functions?
Chapter 12 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Ch. 12.1 - Which file access flag would you use if you want...Ch. 12.1 - Prob. 12.2CPCh. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Write a statement that defines an fstream object...Ch. 12.5 - Assume the file input.txt contains the following...Ch. 12.5 - Describe the difference between reading a file...Ch. 12.5 - What will be stored in the file out.txt after the...Ch. 12.10 - Describe the difference between the seekg and the...
Ch. 12.10 - Describe the difference between the tellg and the...Ch. 12.10 - Describe the meaning of the following file access...Ch. 12.10 - What is the number of the first byte in a file?Ch. 12.10 - Briefly describe what each of the following...Ch. 12.10 - Describe the mode that each of the following...Ch. 12 - What capability does the fstream data type provide...Ch. 12 - Which file access flag do you use to open a file...Ch. 12 - Assume the file data.txt already exists, and the...Ch. 12 - How do you combine multiple file access flags when...Ch. 12 - Should file stream objects be passed to functions...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - How do you read the contents of a text file that...Ch. 12 - What arguments do you pass to a file stream...Ch. 12 - What arguments do you pass to a file stream...Ch. 12 - Prob. 12RQECh. 12 - Prob. 13RQECh. 12 - How do you get the byte number of a files current...Ch. 12 - If a program has read to the end of a file, what...Ch. 12 - How do you determine the number of bytes that a...Ch. 12 - How do you rewind a sequential-access file?Ch. 12 - The _____ file stream data type is for output...Ch. 12 - If a file fails to open, the file stream object...Ch. 12 - The same formatting techniques used with...Ch. 12 - The _____ function reads a line of text from a...Ch. 12 - The ____________ member function reads a single...Ch. 12 - The ________member function writes a single...Ch. 12 - Prob. 24RQECh. 12 - __________ files contain data formatted as...Ch. 12 - Prob. 26RQECh. 12 - Prob. 27RQECh. 12 - The ___________ member function writes raw binary...Ch. 12 - The __________ member function reads raw binary...Ch. 12 - Prob. 30RQECh. 12 - In ___________ file access, the contents of the...Ch. 12 - In __________ file access, the contents of a file...Ch. 12 - The _____________ member function moves a files...Ch. 12 - The ___________ member function moves a files...Ch. 12 - The __________ member function returns a files...Ch. 12 - The ___________ member function returns a files...Ch. 12 - The __________ mode flag causes an offset to be...Ch. 12 - The __________ mode flag causes an offset to be...Ch. 12 - The ________ mode flag causes an offset to be...Ch. 12 - A negative offset causes the files read or write...Ch. 12 - Write a statement that defines a file stream...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write a program segment that defines a file stream...Ch. 12 - Write code that opens the file data.txt for both...Ch. 12 - Write code that determines the number of bytes...Ch. 12 - The infoFile file stream object is used to...Ch. 12 - T F Different operating systems have different...Ch. 12 - T F fstream objects are only capable of performing...Ch. 12 - T F ofstream objects, by default, delete the...Ch. 12 - T F ifstream objects, by default, create a file if...Ch. 12 - T F Several file access flags may be joined by...Ch. 12 - T F A file may be opened in the definition of the...Ch. 12 - T F If a file is opened in the definition of the...Ch. 12 - T F A file stream objects fail member function may...Ch. 12 - T F The same output formatting techniques used...Ch. 12 - T F The operator expects data to be delimited by...Ch. 12 - T F The getline member function can be used to...Ch. 12 - T F It is not possible to have more than one file...Ch. 12 - T F Binary files contain unformatted data, not...Ch. 12 - T F Binary is the default mode in which files are...Ch. 12 - T F The tellp member function tells a file stream...Ch. 12 - T F It is possible to open a file for both input...Ch. 12 - fstream file(ios::in | ios::out);...Ch. 12 - ofstream file; file.open (info.dat, ios::tin); if...Ch. 12 - fstream file("info.dat"); if (!file) { cout ...Ch. 12 - fstream dataFile("info.dat", ios:in | ios:binary);...Ch. 12 - Prob. 69RQECh. 12 - fstream dataFi1e("info.dat", ios:in); char...Ch. 12 - Prob. 71RQECh. 12 - fstream inFile("info.dat", ios:in); int x;...Ch. 12 - File Head Program Write a program that asks the...Ch. 12 - File Display Program Write a program that asks the...Ch. 12 - Punch Line Write a program that reads and prints a...Ch. 12 - Tail Program Write a program that asks the user...Ch. 12 - Line Numbers (This assignment could be done as a...Ch. 12 - String Search Write a program that asks the user...Ch. 12 - Sentence Filter Write a program that asks the user...Ch. 12 - Array/File Functions Write a function named...Ch. 12 - File Encryption Filter File encryption is the...Ch. 12 - File Decryption Filter Write a program that...Ch. 12 - Prob. 11PCCh. 12 - Prob. 12PCCh. 12 - Inventory Program Write a program that uses a...Ch. 12 - Inventory Screen Report Write a program that reads...Ch. 12 - Average Number of Words If you have downloaded...Ch. 12 - Customer Accounts This program should be designed...
Knowledge Booster
Similar questions
- explain friend functions.arrow_forward1. in C: write program with struct student, that has name and age. Declare a pointer to struct student *ptr, but don't assign a value to it. Then, print ptr->age. 2. What GDB commands would you use to identify the error that occurs?arrow_forwardDefine the function lake_to_tli3_dict(readings) that takes a list of (lake_name, chla, tn, tp) tuples and returns a dict mapping lake names to trophic level index values. That is, the keys are lake names and the values will be TLI3 values. Notes: You will need to have import math as your first line of code. You must include and use/call the trophic_level_index function that you wrote in Question 1. trophic_level_index must still work as specified in Question 1. Lakes should be added to the dictionary in the same order as they appear in the readings list. If a lake appears in the readings list more than once, then the TLI for the last occurrence in the readings list should be the one that appears in the result. (This should happen naturally, since the lake name can only occur in the dictionary once.) For example: Test Result names_cnp_1 = [('Lake Brunner', 0.8, 218.0, 6.0), ('Lake Carrot', 5.1, 505.0, 18.5) ] tli3_dict = lake_to_tli3_dict(names_cnp_1 ) print(tli3_dict)…arrow_forward
- Which of the following is true? a) Union may be compared using the == operator. b) The address operator (&) can not be used to take the address of a union. c) Unions may only contain two data types. d) Only one union members and thus one data type can be referenced at a time.arrow_forwardWhat is the difference between 'delete' and 'deletel' in C++? Select one: a.delete is the correct operator, but deletel operator does not exist b.delete is used to delete automatic objects whereas deletel is used to delete pointer objects c.delete is used to delete single dynamic object whereas deletel is used to delete dynamic array objects d.delete is a keyword whereas delete] is an identifierarrow_forwardWhat Is Shell Sort?arrow_forward
- Which of the following statements is NOT correct? Group of answer choices C++ language provides a set of C++ class templates to implement common data structures, which is known as Standard Template Library (STL); In STL, a map is used to store a collection of entries that consists of keys and their values. Keys must be unique, and values need not be unique; In STL, a set is used to store a collection of elements and it does not allow duplicates; Both set and map class templates in STL are implemented with arrays.arrow_forwardWhat are inline functions ? What are their advantages? Give example.arrow_forwardC++ Code: In checkpoint B, you will build on checkpoint A to load (from standard input) a database of individuals and their known counts for several STRs (Short Tandem Repeats). Given a query DNA sequence, you will then check the database to find the name of the individual most likely to have that DNA. You will implement the following functions: /** * Reads from standard input a list of Short Tandem Repeat (STRs) * and their known counts for several individuals * * @param nameSTRs the STRs (eg. AGAT, AATG, TATC) * @param nameIndividuals the names of individuals (eg. Alice, Bob, Charlie) * @param STRcounts the count of the longest consecutive occurrences of each STR in the DNA sequence for each individual * @pre nameSTRs, nameIndividuals, and nameSTRs are empty * @post nameSTRs, nameIndividuals and STRcounts are populated with data read from stdin **/ void readData(vector<string>& nameSTRs, vector<string>& nameIndividuals, vector<vector<int>>&…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr