How To Open Zipx File Online?

How to open a file in C++ and set its values into an array?

  • I have to write the definition for this function. However, I am having trouble setting up an array that corresponds to the contents of the file. so far I have the first part down, but I need help loading it into the array. This is what I have so far { string filename; cout<<"Enter board filename: " ; cin>>filename; ins.open (filename.c_str()); if(ins.good()) { return true; } else { while(!ins.good()) { cout<<"Error opening file"<<endl; ins.clear(); return false; } } return true; } This is what I have to have my funtion do: Asks for name of a file to read data from // Opens the file // The first number in the file (say, k) will be the number of rows // and number of columns // The rest of the file contains the data // // You may assume that the rest of the file contains k*k data items // You may also assume that k <= SIZE // // The function reads the data and enters valid data into the array // // If all goes well, sets n to k (that is, the number of rows & cols) // and returns true // // If anything goes wrong, returns false. It is okay to set n and // the elements of array a to arbitrary values in that case. // // Prompt: "Enter the name of file: " // "File didn't open" // "Wrong datatype in file"

  • Answer:

.#include <keperkjr> at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.