Thread: help with simple code

  1. #1
    Registered User
    Join Date
    Jul 2004

    help with simple code

    I am just trying to make my own copy file command, and it doesnt seem to be working. Can someone help. With the attached code it only copies 7 bytes of the 56 byte picture (its a small picture). So whats up with this?
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    int main ( int argc, int argv[] )
          ifstream indata;
          ofstream outdata;
"note.gif",ios::in | ios::binary);
"copy.gif",ios::out | ios::binary);
          char send_msg[100];
          indata.get(send_msg, 100);
      return 0;
    Last edited by Salem; 07-27-2004 at 01:18 PM. Reason: Added code tags - please remember to use them in future

  2. #2
    Registered User
    Join Date
    Oct 2001
    >indata.get(send_msg, 100);

    You could use rdbuf():
    outdata << indata.rdbuf();
    Or another idea is read(), followed by write().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 14
    Last Post: 11-23-2005, 07:53 AM
  2. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Windows Programming
    Replies: 0
    Last Post: 10-14-2002, 01:29 PM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 11:51 AM
  4. Simple Code, looking for input.
    By Alien_Freak in forum C Programming
    Replies: 3
    Last Post: 03-03-2002, 10:34 AM
Website Security Test