Results 1 to 3 of 3

Thread: read in and write out

  1. #1
    Guest

    read in and write out

    please tell me how to read in a .JPEG file, and rewrite it using a different filename? Please help...

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Vancouver BC Canada
    Posts
    417

    Re: read in and write out

    Originally posted by happyhappy:
    please tell me how to read in a .JPEG file, and rewrite it using a different filename? Please help...
    Oh... how about something like:


    FILE *in, *out;
    char buff[1024];

    in = fopen("mypic.jpg", "rb");

    out = fopen("mypic2.jpg", "wb");

    while (fread(buff, sizeof(buff), 1, in) > 0)
    {
    fwrite(buff, sizeof(buff), 1, out);
    }

    fclose(in);
    fclose(out);


    That's just off the top of my head, so, watch for bugs.

  3. #3
    Member Contributor
    Join Date
    Dec 2000
    Location
    Halifax, Nova Scotia, Canada
    Posts
    86

    Re: read in and write out

    If all you need is a copy, you could try
    system("copy file.jpg newfile.jpg");

Similar Threads

  1. Replies: 4
    Last Post: 10-23-2018, 04:47 AM
  2. Read and write from/to the same texture
    By Java Cool Dude in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 06-26-2008, 08:08 PM
  3. fbo - read previous / write to current
    By powermax in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-18-2008, 01:33 PM
  4. read and write to the same fbo
    By Vexator in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 11-05-2007, 11:39 AM
  5. Replies: 5
    Last Post: 12-09-2006, 10:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean