1. Engineering
  2. Computer Science
  3. c im trying to read a file of integers into...

Question: c im trying to read a file of integers into...

Question details

C++: I'm trying to read a file of integers into an array in c++. I can't use vectors and the file size could change. I had attempted to create a function to open the file once and get the count of items in the file then initialize the array to store the data in main with that number, however C++ won't let me unless it's a constant value. What is the best way to read data from a file into an array if the size is not given? Examples are greatly appreciated.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution