If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

The data type that's expected is int, but you changed your array type to char.

But before going on, where did you get this code from, or are you trying to write something yourself "off the cuff"?

I ask this, since all the code I know of that teaches you passing arrays as parameters do not show doing what you're doing. If you're passing a one dimensional array, you pass the array name only. The receiving function then would have a prototype as the following:

Code:

void arrayToFile(std::ofstream&, int*, int)

or

Code:

void arrayToFile(std::ofstream&, int[], int)

Both of these prototypes are exactly the same. Arrays decay to pointers when you pass the name of the array. In reality, when you "pass arrays", the address of the first item in the array is actually passed.