Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13, Problem 4RQE
The__________ header file is required for file I/O operations.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
This marks the location of the next item that will be read from a file.a. input positionb. delimiterc. pointerd. read position
The standard library function int fseek(FILE *fp, long offset, int origin) is identical to Iseek except that fp is a file pointer instead of a file descriptor and the return value is an int status, not a position. Write fseek. Make sure that your fseek coordinates properly with the buffering done for the other functions of the library.
...ex2_main.cpp#include <stdio.h>#include <stdlib.h>#include "lab2_ex2.h"
#define FILENAME "statement11.txt"
int main(){ // 1. Acquire the text from file char *text = read_text_file(FILENAME); // Note: Caller should free the memory allocated printf("%s\n", text);
// 2. Compute the readability and display the grade level float readability = get_readability(text); printf("Readability index = %f\n", readability); display_level(readability);
// 3. Free resources, e.g. allocated memory by read_text_file() function free(text);
return 0;}...lab2_ex2.cpp/* EDIT THIS FILE TO SOLVE THE LABORATORY EXERCISES*/
#include <stdio.h>#include <ctype.h>#include <string.h>#include <math.h>#include <stdlib.h>#include "lab2_ex2.h"
/*Assume that a letter is any lowercase character from a to zor any uppercase character from A to Z*/int alpanumeric_count(const char *text){ int count = 0;
/* YOUR CODE HERE!!! */
return…
Chapter 13 Solutions
Starting Out with C++: Early Objects
Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - What is the purpose of the second parameter to the...Ch. 13.1 - Why is it important for a program to close an open...Ch. 13.1 - Which file open flag causes all output to take...Ch. 13.1 - Which file open flag causes the contents of an...Ch. 13.1 - What happens if ios: :out is used by itself to...Ch. 13.1 - What happens if ios::out is used by itself to open...Ch. 13.1 - Write a sequence of C++ statements that reads in...Ch. 13.1 - Write a sequence of C++ statements that reads in...
Ch. 13.1 - Show how to use the constructor of the fstream...Ch. 13.1 - Consider two parallel arrays of the same size, one...Ch. 13.3 - Make the required changes to the following program...Ch. 13.3 - Describe the purpose of the eof member function.Ch. 13.3 - Assume the file input.txt contains the following...Ch. 13.3 - Describe the difference between reading a file...Ch. 13.3 - Describe the difference between the getline...Ch. 13.3 - Describe the purpose of the put member function.Ch. 13.3 - What will be stored in the file out.dat after the...Ch. 13.3 - The following program skeleton, when complete,...Ch. 13.5 - Write a short program that opens two files...Ch. 13.5 - How would the number 479 be stored in a text file?...Ch. 13.5 - Describe the differences between the write member...Ch. 13.5 - What arc the purposes of the two arguments needed...Ch. 13.5 - What are the purposes of the two arguments needed...Ch. 13.5 - Describe the relationship between fields and...Ch. 13.5 - Prob. 13.27CPCh. 13.7 - Describe the difference between the seekg and the...Ch. 13.7 - Describe the difference between the tellg and the...Ch. 13.7 - Describe the meaning of the following file access...Ch. 13.7 - What is the number of the first byte in a file?Ch. 13.7 - Briefly describe what each of the following...Ch. 13.7 - Describe the mode that each of the following...Ch. 13 - Prob. 1RQECh. 13 - Before a file can be used, it must first beCh. 13 - When a program is finished using a file, it shouldCh. 13 - The__________ header file is required for file I/O...Ch. 13 - Prob. 5RQECh. 13 - The_____________ file stream data type is for...Ch. 13 - The____________ file stream data type is for input...Ch. 13 - The ______ file stream data type is for output...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write two statements that use the people file...Ch. 13 - Write two statements that use the pets file stream...Ch. 13 - Write two statements that use the places file...Ch. 13 - If a file fails to open, the file stream object...Ch. 13 - Write a program segment that defines a file stream...Ch. 13 - The same formatting techniques used with ______...Ch. 13 - The ______ member function reports when the end of...Ch. 13 - The ______ function reads a line of text from a...Ch. 13 - The _______ member function reads a single...Ch. 13 - The _____ member function writes a single...Ch. 13 - Prob. 22RQECh. 13 - Prob. 23RQECh. 13 - Prob. 24RQECh. 13 - In C++, _______ provide a convenient way to...Ch. 13 - The _______ member function writes raw binary data...Ch. 13 - The _______ member function reads raw binary data...Ch. 13 - The ______ operator is necessary if you pass...Ch. 13 - In _______ file access, the contents of the file...Ch. 13 - In _____ file access, the contents of a file may...Ch. 13 - The _______ member function moves a files read...Ch. 13 - The ______ member function moves a files write...Ch. 13 - The _______ member function returns a files...Ch. 13 - The _______ member function returns a files...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to he...Ch. 13 - A negative offset causes the files read or write...Ch. 13 - Give a pseudocode algorithm for determining the...Ch. 13 - Give a pseudocode algorithm for comparing two...Ch. 13 - Prob. 41RQECh. 13 - Suppose that you have two text files that contain...Ch. 13 - Each of the following programs or program segments...Ch. 13 - File Previewer Write a program that asks the user...Ch. 13 - File Display Program Write a program that asks the...Ch. 13 - Punch Line Write a program that reads and prints a...Ch. 13 - Tail of a File Write a program that asks the user...Ch. 13 - String Search Write a program that asks the user...Ch. 13 - Sentence Filter A program that processes an input...Ch. 13 - File Encryption Filter File encryption is the...Ch. 13 - File Decryption Filter Write a program that...Ch. 13 - Letter Frequencies The letter e is the most...Ch. 13 - Put It Back C++ input stream classes have two...Ch. 13 - Prob. 11PCCh. 13 - Insertion Sort on a File II Modify the program...Ch. 13 - Prob. 13PCCh. 13 - Prob. 14PCCh. 13 - Inventory Program Write a program that uses a...Ch. 13 - Inventory Program Write a program that uses a...Ch. 13 - Group Project 17. Customer Accounts This program...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Employee and ProductionWorker Classes Create an Employee class that has properties for the following data: Empl...
Starting out with Visual C# (4th Edition)
Why is it useful for a programmer to have some background in language design, even though he or she may never a...
Concepts Of Programming Languages
The hexadecimal number system has 16 characters, six of which are alphabetic characters.
Digital Fundamentals (11th Edition)
What is an object? What is a control?
Starting Out With Visual Basic (8th Edition)
Car Loan If A dollars are borrowed at r interest compounded monthly to purchase a car with monthly payments for...
Introduction To Programming Using Visual Basic (11th Edition)
A(n) _______ function has no body, or definition, in the class in which it is declared.
Starting Out with C++ from Control Structures to Objects (9th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 377. File access type supported by most modern operating systems are said to be a. Sequential access files b. Random access files c. Structural access files d. Direct access filesarrow_forwardWhen a file is opened, a(n)_________ is created, which is a small holding section of memory that data is first written to.arrow_forwardCreate a brief code segment that moves the file pointer 50 bytes from the file's start. Assume the file is already open and BX has the file handle.'arrow_forward
- Write a short code segment that positions the file pointer 50 bytes from the beginning of afile. Assume that the file is already open, and BX contains the file handle.arrow_forwardWhen a program works with an input file, a special value known as a(n) __________ is internally maintained for that file and marks the location of the next item that will be read from the file. a. input locator b. accumulator c. read position d. sequential read valuearrow_forward373. File operation used with random access files to first position pointer to a specific place in a file, is known to be a. Pointer b. Cursor c. Current locator d. Seekarrow_forward
- Create the code that will allow you to define a variable that will be used to read data from a sequential access file. inFile is the name of the variable.arrow_forwardThe __________ member function returns a file’s current write position.arrow_forward*****PLEASE WRITE IN C# (C SHARP)***** Write a program that will create file with at least 10 lines. Each line of your file should have information delimited by some delimiter (I.e., commas, spaces, slashes, symbols, etc.). After your file has been created with the proper amount of data, you should read your file line by line and display without the delimiters in the same program after closing your writer. Additionally, the information stored into your file should be data that is gathered from a separate class. Your program should save your file in a specific directory. To promote flexibility, your program should check to see if the chosen directory exists prior creating it, and if it does not exist, your program should create it for you. Additionally, you should allow the user to enter the names of the directory and file instead of hard-coding it into your program.arrow_forward
- Computer Science Create a function that can find the largest writable and non-writable file by the user in a directory without subdirectories (flat directory). This function will be part of a program named maxfile that can be invoked like this: ./maxfile <directory> You will be reading the contents of the directory passed as the only argument to your program using the function readdir(). Begin by opening the directory using opendir(), and obtain information for every file using stat(). stat() allows you to check whether a file is a regular file or a directory. (In this assignment, hard and symbolic links, special files, etc. will be ignored.) At the end, close the directory using closedir(). For Functionality 1, the input will be assumed to be a flat directory and subdirectories should not be traversed. Regular files must be separated into those for which the user has permission to write and those for which the user does not have permission to write. For each of the two types…arrow_forwardWrite a function sum_file(f) that takes a filename f. Each line in f contains asingle number. You should write to the last line in the file the sum of all thenumbers written in the file.arrow_forwardWrite a single statement to accomplish each of the following. Assume that each of thesestatements applies to the same program.a) Write a statement that opens the file "oldmast.dat" for reading and assigns the returned file pointer to ofPtr.b) Write a statement that opens the file "trans.dat" for reading and assigns the returnedfile pointer to tfPtr.c) Write a statement that opens the file "newmast.dat" for writing (and creation) and assigns the returned file pointer to nfPtr.d) Write a statement that reads a record from the file "oldmast.dat". The record consistsof integer accountNum, string name and floating-point currentBalance.e) Write a statement that reads a record from the file "trans.dat". The record consists ofthe integer accountNum and floating-point dollarAmount.f) Write a statement that writes a record to the file "newmast.dat". The record consists ofthe integer accountNum, string name and floating-point currentBalance.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License