hi, im having a few problems at the minute which involve reading a certain amount of bytes from a file. I have a program that will store an int value( could be anything depnding on the file.) However say for example my int has the value 50 stored in it I would then like to read 50 bytes from the file and store it into a string. I thought i had managed to achieve this but it only seems to read out the first couple of bytes into my string and that is it, could anyone see where ive gone wrong?
Code:
infile.seekg(posInFile, ios::cur); //getting to the right pos in file
int properpathstart; //This is the int value telling me how much to strip from the file
char* PATHSTRING = new char[properpathstart]; //not sure if this is the right type of struct to store it
infile.read( PATHSTRING, properpathstart ); // attempting to read in file
string pAtH = PATHSTRING; //storing as a string
thank you