rem: fprintf(stderr,"%d bytes done\n",x);
context: gboolean FileToMemory(const char* filename, unsigned char *buffer, unsigned int maxlength) {  // This function expects that you've already changed the parition and   // directory to the correct path in the camcorder.    int count,x,i;  int data;  //CFile file;    unsigned char sfilename[256];    file_info fileinfo;  if(GetAnyFileInfo(filename,&fileinfo)==FALSE) {    Log("Trouble getting file size information");    return FALSE;  }    if(fileinfo.filesize>maxlength) {    //Log("Failed "+filename+" is larger than memory buffer.");    Log("Failed, file is larger than memory buffer.");    return(FALSE);  }    memset(sfilename,0,255);  strcpy((char *)sfilename,filename);    if(ControlMessageWrite(0xb101,(int *)sfilename,strlen((char *)sfilename)+1, TIMEOUT)==FALSE) { // SetFileName	    Log("failed at 0xb1");    return(FALSE);  }      data=0x00;  if(ControlMessageWrite(0x9301,&data,0,TIMEOUT)==FALSE) { // Request File Read        Log("failed at 0x93");    return FALSE;  }      //NOTE: we keep grabbing bytes until the camcorder is done feeding us.  x=0;    for(i=0;;i++) {    count=Read(buffer+x,BUFSIZE,TIMEOUT);    if(count<1)      break;    x=x+count;    fprintf(stderr,"%d bytes done\n",x);    if(count<BUFSIZE)      break;    //DoMessagePump();  }  return TRUE;}