Create a function called file_reader() with the following parameters/arguments: a. file_to_read ● String datatype ● Should contain the name of the file that you wish to write to b. num_lines ● Integer datatype ● Should contain the number of lines that you would like to read from the file

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 9PP: (Inventory) Create an ASCII file with the following data, or use the shipped.dat file available on...
icon
Related questions
Question

 Create a function called file_reader() with the following parameters/arguments:
a. file_to_read
● String datatype
● Should contain the name of the file that you wish to write to
b. num_lines
● Integer datatype
● Should contain the number of lines that you would like to read from the
file

down below is what I have, im just not too sure how to indicate the 3 lines i would like read from the file:

function file_reader(string $file_to_read, int num_lines) {
        $file_to_read = fopen($file_to_read, "r") or die ("unable to read file");
            for ($i = 0; $i <$num_lines){
            _______________________
        } 
    }

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Data Binding
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning