Well that didnt take long to shorten as i thought it would ....
anyway here is the code, still giving me the same error
Code:
#include "practice.h"
/*
Expect a series of images of the form base0000.ppm, base0001.ppm, etc
Supports forward or reverse image ordering
*/
void ReadImageData(char *, headerstruct*);
int main(int argc, char **argv)
{
filenamestruct *ptr_file;
headerstruct *ptr_header;
ptr_file = new filenamestruct;
ptr_header = new headerstruct;
strncpy(ptr_file->nextFileName,argv[1], strlen(ptr_file->nextFileName));
strncpy(ptr_header->height,"708",3);
strncpy(ptr_header->width,"492",3);
ptr_header->headerend = 15;
ReadImageData(ptr_file->nextFileName, ptr_header);
}
void ReadImageData(char * fname, headerstruct *temp_head){
int *ptr_data;
int i=0, NumByteRead = 0;
FILE *temp_fptr;
size_t j=0, count = 0, sizeofoneitem = 1;
NumByteRead = (atoi(temp_head->width) * atoi(temp_head->height));
ptr_data = new int[3*NumByteRead];
temp_fptr = fopen(fname,"rb");
while(j<(temp_head->headerend)){j++;getc(temp_fptr);}
fread(ptr_data, sizeofoneitem, (3*NumByteRead), temp_fptr);
printf("\nValue in first buffer(ptr_data[0]) - %x", ptr_data[0]); //max of 261251
fclose(temp_fptr);
}