ok, i've got a simple program thats supposed to join a bunch of files together into one big dat file.
#include <fstream.h>
#include <iostream.h>
#include "vars.h"
void main(void)
{
ifstream inFiles;
ofstream datFile;
char *buffer;
datFile.open("thps2.dat", ios::binary | ios::ate);
int test;
for(int i = 0; i < 67; i ++)
{
inFiles.open(fileNames[i], ios::binary | ios::ate);
inFiles.seekg(0, ios::end);
test = inFiles.tellg();
buffer = new char[test];
inFiles.seekg(0, ios::beg);
inFiles.read(buffer, sizeof(buffer));
cout<<sizeof(buffer);
datFile.write(buffer, sizeof(buffer));
delete[] buffer;
inFiles.close();
}
}
the problem is that each time throught the for loop my buffer only gets set to four instead of the result of inFile.tellg(); or for some reason inFile.tellg(); is only returning four.
can anyone tell me why?



LinkBack URL
About LinkBacks


