
May 7th, 2008, 03:47 PM
|
|
Registered User
|
|
Join Date: May 2008
Posts: 1
Time spent in forums: 11 m 58 sec
Reputation Power: 0
|
|
|
Array and File Function
So, my name is a great respresentation of what this is. I'm a very very basic programmer who missed a big chunck of the learning from using file's and pointers. Now I have this challenge, and any help on how to do it or get started would be greatly appreciated. I also want to add I dont want to give off the impression I want someone to do my homework on this.
Here is the challenge.
Write a function named arrayToFile. The functions should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. The function should open the specified file in binary mode, write the contents of the array to the file, and then close the file.
Write another function named fileToArray. This function should accept three arguments: the name of the file, a pointer to an int array, and the size of the array. The function should open the specified file in binary mode, read its contents into the array and then close the file.
Write a complete program that demonstrates these functions by using the arrayToFile function to write an array to a file, and then using the fileToArray function to read the data from the same file. After the data is read from the file into the array , display the array's contents on the screen.
As I said, I know zilch about files with C++. Thanks alot for any help that is given. It is greatly appreciated.
|