0 Members and 1 Guest are viewing this topic.
ifstream app(filename, ios::binary); char Convbuf; // buffer to hold one byte at a time from the Conversion app for( int counter = 0 ; counter < 0x7000; counter++) { Conv.read(&Convbuf,1); app << Convbuf; }
ifstream app(filename, ios::binary); char Convbuf; Conv.seekg(0, ios::beg); app.seekp(0, ios::beg); Conv.read(&Convbuf,1); for( int counter = 1 ; counter < 0x7000; counter++) { app.write(&Convbuf, 1); Conv.seekg(counter); app.seekp(counter); }
I would use functions like "fwrite", "fread", "fopen", "fclose", etc: if VC++ 2010 doesn't support them, MSDN is a liar. There's an example on the MSDN page for fread.
ifstream app(filename, ios::binary); char Convbuf[0x7000]; char Convbuft; FILE * appstream; fopen_s(&appstream, filename, "w+t"); Conv.seekg(0, ios::beg); for( int counter = 0 ; counter < 0x7001; counter++) { Conv.read(&Convbuft,1); Convbuf[counter] = Convbuft; } fwrite(Convbuf, 0x7000, 0x7000, appstream); cin.get(); return 0;
are you sure you are including the files them correctly?Also, did you put: "using namespace std;" in the file, right after the includes?
Actually, I think it's because you defined the file object as ifstream, which only supports input operations. Try using ofstream for outputting.
// app_signer.cpp : Defines the entry point for the console application.#include "stdafx.h"#include <fstream>#include <iostream>using namespace std;int main(void){ ifstream codename("progname.txt", ios::in|ios::binary); if(!codename.is_open()) { cout << "cannot find progname.txt"; cin.get(); exit(1); } char hexfile[50]; while(!codename.eof()) { codename.getline(hexfile, 49); } codename.close(); ifstream code(hexfile, ios::in|ios::binary); if(!code.is_open()) { cout << "cannot find " << hexfile; cin.get(); exit(1); } int startcode; int stopcode; int sizecode; startcode = code.tellg(); code.seekg (0, ios::end); stopcode = code.tellg(); sizecode = stopcode - startcode; code.seekg (0, ios::beg); ifstream Conv("Conv.g3a", ios::in|ios::binary); if(!Conv.is_open()) { cout << "cannot find Conv.g3a"; cin.get(); exit(1); } char filename[50]; for(char counter = 0; counter < 50; counter++) { if(hexfile[counter] == '.') { for(char counter2 = 0; counter2 < counter; counter2++) { filename[counter2] = hexfile[counter2]; if(counter2 + 1 == counter) { filename[counter2 +1] = '.'; filename[counter2 +2] = 'g'; filename[counter2 +3] = '3'; filename[counter2 +4] = 'a'; for(char counter3 = counter2 +5; counter3 < counter; counter3++) { filename[counter3] = ' '; } break; } } break; } } ifstream app(filename, ios::binary); char Convbuf; ofstream app(filename, ios::out|ios::binary); app.seekg(0, ios::beg); Conv.seekg(0, ios::beg); Conv.read(&Convbuf, 1); for( int counter = 1 ; counter < 0x7001; counter++) { app.write(&Convbuf, 1); //ERROR: write method not recognized Conv.seekg(counter); app.seekg(counter); } cin.get(); return 0;}