home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,460 of 33,346   
   Alexander Bartolich to fryme   
   Re: Multiple files in one   
   12 Sep 11 17:31:41   
   
   638a603c   
   XPost: comp.lang.c++   
   From: alexander.bartolich@gmx.at   
      
   fryme wrote:   
   > [...]   
   > For that purpose i'm using std::ios::binary. Here is some code,   
   > describes that process (it is sketch, not last variant):   
      
   You expect us to find bugs in a "sketch"?   
      
   > [...]   
   > std::fstream m_out(output_file_path, std::ios::out |   
   > std::ios::binary);   
   > std::ifstream input_image(m_image_file_path.toUtf8().data());   
                                                 ^^^^^^^^^^^^^^^   
   All right, you are using Qt.   
      
   > input_image.seekg(0, std::ios::end);   
   > image_length = input_image.tellg();   
   > input_image.seekg(0, std::ios::beg);   
   >   
   > // writing image length to output file   
   > m_out.write( (const char *)&image_length, sizeof(long long) );   
   >   
   > char *buffer = new char[image_length];   
   > input.read(buffer, image_length);   
     ^^^^^   
   I guess you mean "input_image", not "input".   
      
   > [...]   
   > std::fstream m_in(m_file_path.toUtf8().data(), std::ios::in );   
      
   There is no "std::ios::binary" here. Is this just a detail missing   
   from the "sketch"?   
      
   > m_in.seekg(0, std::ios::beg);   
   > m_in.read((char *)&image_length, sizeof(long long));   
   > m_in.seekg(sizeof(long long));   
      
   As far as I know, the second argument of "seekg" has no default value.   
      
   > [...]   
   > std::fstream fs("E:\\Temp\\out.jpg");   
      
   Again no "std::ios::binary" here.   
      
   Please, create working example code.   
      
   --   
   host -t mx moderators.isc.org   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca