25 lines
404 B
C++
25 lines
404 B
C++
#include <iostream>
|
|
#include <string>
|
|
#include <fstream>
|
|
|
|
int main() {
|
|
|
|
std::ifstream file("test.txt");
|
|
|
|
// read words separated by whitespaces or newlines
|
|
// std::string str;
|
|
// while (file >> str)
|
|
// std::cout << str << std::endl;
|
|
|
|
// skip whitespaces or newlines
|
|
// char c;
|
|
// while (file >> c)
|
|
// std::cout << c << std::endl;
|
|
|
|
// seems good
|
|
char c;
|
|
while (file.get(c))
|
|
std::cout << c;
|
|
|
|
}
|