d01 ex04 boucle lecture ok

This commit is contained in:
Hugo LAMY
2022-02-06 19:43:54 +01:00
parent e165ba887d
commit bb43bb40e8
4 changed files with 112 additions and 0 deletions

24
d01/ex04/main.cpp Normal file
View File

@@ -0,0 +1,24 @@
#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;
}