I have created a unix program that converts a targa file to a YUV video file. I used unsigned char*'s to handle the file data. I can read large files into my char*'s but am unable to put those large char*'s back into a file. If the file is small (80K) there is no problem writing to file. But when I try 1.1 megs (which is my goal) the new file size is 1 byte (the first byte of the char pointer).
How can I write a large unsigned char* to a newly created file? I can currently read in large files but not write to a new one. I have tried setbuf() as well as fputc() in a loop but either way my file size is 1. (unless the original data is less then about 133kb).
here is a sample of what I am trying. yuv is my unsigned char *
please presume that memory and variables have been correctly allocated or declared
/****** code sample ********/
unsigned char* tempPtr;
if( (Nfp = fopen(newfile, "w" )) == NULL)
printf("Problem creating new file!\n");
for(x=0;x<w*h*2;x++); //w*h*2 is the length of yuv
tempPtr = yuv + x;
any ideas would greatly help