Hi All,
There is an error here, can any body tell me how to do it right? (copy from text file to Binary file)
error C2664: 'fwrite' : cannot convert parameter 1 from 'char' to 'const void *'
There is an error here, can any body tell me how to do it right? (copy from text file to Binary file)
Code:
#include "stdio.h"
#include "iostream.h"
#include "fstream.h"
void main()
{
ifstream inFile;
inFile.open("c:\\file.txt");
FILE *pBinaryFile;
char buffer;
//pTextFile = fopen("c:\\file.txt", "r");
pBinaryFile = fopen("binaryfile.bin", "wb");
while(! inFile.eof())
{
buffer= inFile.get();
fwrite(buffer, 1, 1, pBinaryFile);
}
fclose(inFile);
fclose(pBinaryFile);
}
Comment