What's Here?
- Members: 149,624
- Replies: 506,753
- Topics: 79,851
- Snippets: 2,666
- Tutorials: 706
- Total Online: 1,965
- Members: 68
- Guests: 1,897
|
|
Submitted By: Xing
|
|
|
Rating:
|
|
Views: 4,681 |
Language: C++
|
|
Last Modified: October 6, 2006 |
Snippet
#include <fstream>
#include <string>
int main(){
//Open file for reading
std::ifstream in("input.dat");
//Open file for writing
std::ofstream out("output.dat");
//Temporary buffer for line read from file
std::string line;
while(getline(in,line)){//getline removes the newline char
out<<line<<'\n'; // Appending back newline char
}
return 0;
}
Copy & Paste
|
|
|
Be Social
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|