Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <a href="https://stackoverflow.com/users/4778/mike">Mike</a>:</p> <blockquote> <p>I hacked together some code to do the job. Here it is. It's not production quality code, so if you do not understand it then do not run it.</p> </blockquote> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; void save_image(const char* filename, FILE* in_fp) { char buf[4096]; size_t read; FILE *fp; fp = fopen(filename, "wb"); if (!fp) { fprintf(stderr, "cannot open file."); exit(1); } do { read = fread(buf,1,sizeof(buf),in_fp); fwrite(buf, 1, read, fp); } while (read); fclose(fp); } int main(int argc, char* argv[]) { char buf[4096]; unsigned int read, read_tot = 0; FILE *fp; int image_count = 1; char filename[255]; unsigned int i; char pattern[] = "JFIF"; int pi = 0; long int curpos; char pad[50]; char src_filename[] = "C:\\Documents and Settings\\mikeking\\Desktop\\WBC\\" "Custom - CATHYS WEDDING.wbc"; char des_directory[] = "C:\\Documents and Settings\\mikeking\\Desktop\\F\\"; fp = fopen(src_filename, "rb"); if (!fp) { fprintf(stderr, "cannot open file."); exit(1); } do { read = fread(buf,1,sizeof(buf),fp); for(i=0; i&lt;read; i++){ if (buf[i] == pattern[pi]) { pi++; if (pi == sizeof(pattern)) { strcpy(filename, des_directory); itoa(image_count, pad, 10); image_count++; strcat(filename, pad); strcat(filename, ".jpg"); curpos = ftell(fp); fseek(fp,read_tot+i-10,SEEK_SET); save_image(filename,fp); fseek(fp,curpos,SEEK_SET); } } else { pi = 0; } } read_tot += read; } while (read); fclose(fp); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload