पढ़ना और लिखना मैं एक बफर फ़ाइल में एक बाइनरी फ़ाइल पढ़ने के लिए कोड लिखने की कोशिश कर रहा हूं, फिर बफर को दूसरी फ़ाइल में लिखें। मेरे पास निम्न कोड है, लेकिन बफर केवल फ़ाइल में पहली पंक्ति से कुछ ASCII वर्णों को संग्रहीत करता है और कुछ भी नहीं।बाइनरी फ़ाइल
int length;
char * buffer;
ifstream is;
is.open ("C:\\Final.gif", ios::binary);
// get length of file:
is.seekg (0, ios::end);
length = is.tellg();
is.seekg (0, ios::beg);
// allocate memory:
buffer = new char [length];
// read data as a block:
is.read (buffer,length);
is.close();
FILE *pFile;
pFile = fopen ("C:\\myfile.gif", "w");
fwrite (buffer , 1 , sizeof(buffer) , pFile);
आपको iostream या C फ़ाइल हैंडलिंग का उपयोग करने का निर्णय लेना चाहिए। कृपया दोनों का उपयोग न करें। – frast