There is an error here, can any body tell me how to do it right? (copy from text file to Binary file)
Expand|Select|Wrap|Line Numbers
- #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);
- }