rem: if (m_ctl_progress) gtk_progress_bar_set_fraction(m_ctl_progress, 0);
context: gboolean DownloadFile(char* saveto, char* filename) {	// This function expects that you've already changed the parition and 	// directory to the correct path in the camcorder. dirpath is the Windows	// path to the file to store in.  int filesize = global_filesize;  int count,x;  int data;  int round;  FILE* file = NULL;  //char* sfilename = filename;  char sfilename[256];  char buffer[BUFSIZE];  printf("DownloadFile(%s, %s)\n", saveto, filename);  strcpy(sfilename, filename);  file = fopen(saveto, "w");  if (file == NULL) {    Log("Trouble opening: ");    Log(filename);    return FALSE;  }  //EnableControls(FALSE);  memset(sfilename, '\0', sizeof sfilename);  strcpy(sfilename,filename);  if(ControlMessageWrite(0xb101, sfilename, strlen(sfilename)+1, TIMEOUT)==FALSE) { //SetFileName    Log("failed at 0xb1");    EnableControls(TRUE);    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;  round = 0;  if (m_ctl_progress) gtk_progress_bar_set_fraction(m_ctl_progress, 0);  while(1) {    count=Read(buffer,BUFSIZE,TIMEOUT);    //Log("reading...");    //if(count<BUFSIZE)    //break;    x += count;    if (x - round > 65536) {      //if (m_ctl_progress) gtk_progress_bar_set_fraction(m_ctl_progress, (gdouble)x / (gdouble)filesize);      m_progressbar_fraction = (double)x / (double)filesize;      round = x;      //gtk_widget_show(main_window); //update?    }        //    printf("x: %d\n", x);    //    file.WriteHuge(buffer,count);    fwrite(buffer, 1, count, file);    if(count<BUFSIZE)      break;    //DoMessagePump();  }    //CString msg; msg.Format("file was %d bytes in size",x); Log(msg);    fclose(file);  Log("Success retrieving file");  //EnableControls(TRUE);  return TRUE;}