C++ Learning Community Forum
September 09, 2010, 08:09:45 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Hello. Smiley
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: My Program for today  (Read 1081 times)
myork
Global Moderator
C++ guru
*****
Posts: 1147


View Profile
« on: April 30, 2007, 05:10:30 PM »

Code:
#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>
 
struct CopyFile
{
    CopyFile(std::ostream& out)
        :m_out(out)
    {}
    void operator()(const char* arg) const
    {
        std::ifstream   file(arg);
        std::copy(std::istreambuf_iterator<char>(file),std::istreambuf_iterator<char>(),std::ostream_iterator<char>(m_out));
    }
    std::ostream&   m_out;
};
 
 
int main(int argc,char*argv[])
{
    std::for_each(&argv[1],&argv[argc],CopyFile(std::cout));
    return(0);
}
Logged
C-Man
Does anyone even read this ?
Global Moderator
Dr. of C++ology
*****
Posts: 988



View Profile WWW
« Reply #1 on: April 30, 2007, 07:45:45 PM »

have a streamy day sir
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!