Reading entire file in one go.
Solution 1:
std::ifstream in("circle.cc");
std::istreambuf_iterator < char > begin(in), end;
std::string str(begin, end);
Solution 2:
std::ifstream input("circle.cc");
std::ostringstream temp;
temp << input.rdbuf();
std::string str = temp.str();
In both the cases,
std::cout << str;
will print out entire file.
Perl solution:
open CIRCLE, "circle.cc";
@mylist = <CIRCLE> ;
close CIRCLE;
C++ and Perl both take 3 lines of code.
Not bad for a system programming language!!
Solution 1:
std::ifstream in("circle.cc");
std::istreambuf_iterator < char > begin(in), end;
std::string str(begin, end);
Solution 2:
std::ifstream input("circle.cc");
std::ostringstream temp;
temp << input.rdbuf();
std::string str = temp.str();
In both the cases,
std::cout << str;
will print out entire file.
Perl solution:
open CIRCLE, "circle.cc";
@mylist = <CIRCLE> ;
close CIRCLE;
C++ and Perl both take 3 lines of code.
Not bad for a system programming language!!
Comments
get a moment to find blogs. Its better than cold iced
tea and I have to visit it one more time!
I wish I was like you, but I'll go and peep your 1800contacts com coupon blog.
blogs, its got to be like yours! And the site is off
the hook! I just kept coming back!
Search for my 1800contacts coupon codes blog, it will leave you speechless.
that I want to visit it more each day! I like
searching for blogs that have the same content like
this one!
I hope you had a chance to check out my blog.
returning to it! When I web surf it always helps me to
find great blogs.
Hey playa! You need to check out my 1800contacts com coupon blog.
visit! And when I'm able to surf the web, I look for
blogs as great as your work.
Click on my coupon 1800contacts blog before its to late.
visit! And when I'm able to surf the web, I look for
blogs as great as your work.
Hey son, you need to check out my coupon 1800contacts blog!
back once again to view it! I use much of my spare
time searching for blogs like yours.
In an efford of finding the right info, check for my blog site.
the internet, when I have the time. I'm going to go
back to it!
Search for my coupon codes 1800contacts blog, please!
Your site was on point and will be back again! Awesome
blog.
If your look to uncover information, please visit my plastic surgery gone wrong blog
job on it, I will be back! I surf the net for blog
like this one.
Please proceed to my plastic surgery dallas blog when you find the time.
Surfing online for blogs like this one is worth my
time. Sensational blog.
Please discover my plastic surgery thailand blog.
ifstream ifs("circle.cc");
cout << ifs.rdbuf();
Hello Guy
I think that Keep posting more informative articles like these one.
These are very good articles to visit...
golden slot mobile