-
October 30th, 2013, 11:11 AM
#1
write to a binary file
This is what I have so far
My function does not work and my compiler says my int array is not initialized
#include <iostream>
#include <cctype>
#include <string>
#include <fstream>
#include <stdio.h>
using namespace std;
void arrayToFile(ofstream tak, int *arr[], int size )
{
for (int i = 0; i<size; i++)
{
tak.write(&arr[i], sizeof(arr[i]));
}
}
//void fileToArray(FILE got, int *arr[], int size1);
int main()
{
int slen;
slen = 2;
int joly[slen] = { 1,2,3,4,5 };
ofstream outfile;
outfile.open("data.bin",ios:ut | ios::binary);
arrayToFile(outfile, *joly, slen);
return 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|